Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
There is an upstream bug in XFCE4 that causes your screen to go blank every 10 minutes if you're not actively using the mouse and keyboard no matter what your ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User Steven_G's Avatar
    Join Date
    Jun 2012
    Location
    Western US
    Posts
    415

    Triggering script to run after program exit?


    There is an upstream bug in XFCE4 that causes your screen to go blank every 10 minutes if you're not actively using the mouse and keyboard no matter what your power or screen saver settings are.

    After doing some poking around on the web I wrote a very basic (my first ever) script to change the xset parameters at startup to prevent this from happening; thus letting the settings that I have configured for the screensaver and power settings in xscreensaver-demo take effect.

    It works as expected.

    I set my screen saver to 30 minute time out.

    I then installed caffeine and set it to prevent screensave activation for xine and netflix-desktop so that I could watch movies without touching the mouse every 1/2 hours.

    Caffeine works, but with one small hitch.

    It returns the xset settings to default; which makes the screen go blank after 10 minutes unless I remember to manually run my start up script that resets xset.

    What I would like to do (and have no idea how and have had no luck with figuring it out through google) is to tell my system to run my script again after both netflix-destop and xine exit so my screen automagically won't go blank if I go raid the fridge after the movie is over.

  2. #2
    Linux User Steven_G's Avatar
    Join Date
    Jun 2012
    Location
    Western US
    Posts
    415
    Well, I'm still digging and I still can't find a way to call a script when an executable terminates.

    So, what about something less eloquent? What if I introduse a wait loop and pgrep for those two processes every 5 minutes then sleep if they're present otherwise just reset the settings every 5 minutes?

    This is what I've got so far:

    #Runs at start up in session GUI
    Code:
    /home/adam/Startup_Scripts/fixscreensaver.sh
    (fixscreensaver.sh)
    Code:
    #!/bin/bash -e
    
    #I started with a sleep command because if I just try to reset xset at login or boot then XFCE *always* 
    #over writes my changes and goes back to default / blanking every 10 minutes 
    sleep 60
    
    #Then apply the changes I want
    xset s noblank
    xset s 0 0
    xset s off
    xset dpms 0 0 0
    
    #Then execute the new script
    -e /home/adam/Startup_Scripts/fixcaffeine.sh
    
    exit0
    Here's the new part, where I could use some help. Will this setup a crude wait loop?

    (fixcaffeine.sh)
    Code:
    #!/bin/bash -e
    
    #Wait 9 minutes
    sleep 540
    
    #Then apply the changes I want
    xset s noblank
    xset s 0 0
    xset s off
    xset dpms 0 0 0
    
    #And start it all over again.
    -e /home/adam/Startup_Scripts/fixcaffeine.sh
    
    exit0
    Here's where I'm stuck. If this was basic I'd just use GOTO 10. Will this create the loop I'm looking for?

    ________________
    Edit: I was going to try to get fancy and grep to see if netflix or xine was running. But I realized that the loop I was creating would go ahead and apply the changes every five minutes any way. I have no idea what effect that will have on caffeine. But, if it has no negative impact it will be a lot eaiser to script.
    Last edited by Steven_G; 03-27-2013 at 08:31 AM.

  3. #3
    Linux User Steven_G's Avatar
    Join Date
    Jun 2012
    Location
    Western US
    Posts
    415
    OK, it's an ugly beast but it works. I ended up having to invoke bash at the end of each script and shorten my interval in the second script by a couple of minutes to get it to work. And for no more than it does it is sucking a ton of systems resources: About 75% of 1 thread and about 300MB of RAM. Why in the world would a simple little sleep loop suck up so many system resources?

    Well, lucky for me my machine is a beast and I have spare resources out the wazoo until I learn how to make it better.

    Any suggestions on how to make it less cludgy and resource intensive would be appreciated.

  4. $spacer_open
    $spacer_close
  5. #4
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,621
    You may get away with a far simpler solution. I provide no warranty other than this worked for me.

    If you have a file called called /etc/X11/xorg.conf then add the following to it
    Code:
    Section "ServerFlags"
    	Option "BlankTime" "0"
    EndSection
    This allows my preferred power management settings to function as expected.

    If your distro has a directory called /etc/X11/xorg.conf.d then create a file in there called whatever_you_want.conf and put the same code in it instead of using the xorg.conf file directly.
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  6. #5
    Linux User Steven_G's Avatar
    Join Date
    Jun 2012
    Location
    Western US
    Posts
    415
    Thanks for the tip. I tried the /etc/X11/xorg.conf.d route, but it had no effect for me.

    I'm running a weird, self rolled set up. I started out with a cli install of ubuntu minimal / core 12.04 over 6 months ago. Over time it has evolved in to a hybrid of 12.04.2 +12.10 +13.04 +rolling from source. This is the only raw spot in the whole mish-mash, so I figure I didn't do too bad for a noob.

    But, this one is like when you get popcorn stuck under you gum: I won't quit poking at it til it's gone.

  7. #6
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,621
    Quote Originally Posted by Steven_G View Post
    Thanks for the tip. I tried the /etc/X11/xorg.conf.d route, but it had no effect for me.
    You may need to reboot to pick up the new settings. I'm about 70% sure I had to

    Quote Originally Posted by Steven_G View Post
    I'm running a weird, self rolled set up. I started out with a cli install of ubuntu minimal / core 12.04 over 6 months ago. Over time it has evolved in to a hybrid of 12.04.2 +12.10 +13.04 +rolling from source. This is the only raw spot in the whole mish-mash, so I figure I didn't do too bad for a noob.
    Do you call that beastie chimera?

    Quote Originally Posted by Steven_G View Post
    But, this one is like when you get popcorn stuck under you gum: I won't quit poking at it til it's gone.
    Been there many times
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  8. #7
    Linux User Steven_G's Avatar
    Join Date
    Jun 2012
    Location
    Western US
    Posts
    415
    Quote Originally Posted by elija View Post
    ...Do you call that beastie chimera?...
    Actually I call it X-Gnome because I took XFCE4, knocked all the tools and programs out of their DE, then grafted all of the Gnome DE tools and programs on to it with out the Gnome shell or DE.

    It's very lightweight, very powerful and runs like a screaming banshee; execpt for this one script.

    And I had no choice to but to create this monster.

    I started on *nix in VMs about ~18+ months ago with doze as the host. Then I tried to move to hardware a year ago. But, I have 64 bit + Optimus hardware and year ago getting that combo up and running was nigh on a guru level project (they've dumbed it down quite a bit in the last year). So, I spent my first 6 months of learning doing some fairly deep level hardware trouble shooting or rather screaming and cussing a lot as I attempted to do some fairly deep level hardware trouble shooting.

    By the time I figured out how to get my hardware working ubuntu had introduced Unity; which I hate with a passion. I played with lots of distros for a good while; IMHO XFCE has the best DE and Gnome has the best tools. So I built what I wanted and got my hardware working in the process.

    Now I'm in the process of building a tool for my education / career that I expect to last me for at least the next 10 years. I'm putting lots of spiffy stuff in to it so I can play, tinker, blow up, rebuild and learn.

    Between what I've already done and what I'm doing some of the features will be:
    1) Most of the latest open-source IDEs
    2) All of the latest open-source decompilers
    3) Open-source compilers
    4) Ultra tight / retarded / NSA level security (I want to get my MS in info sec)
    5) Compartmentalized computing on 1 box.
    6) Drap and drop virtual networks with routers, gateways, proxy's and clients all configurable in thousands of ways.
    7) The ability to do a full recovery to last back up in less than 4 hours on same hardware if I foul something up or different hardware if something dies.
    8 ) ~75 VMs, many self built for specific purposes on a VM specific fork of X-Gnome, many running the latest and greatest sec distros / tools.

    And, ubuntu forced me to go hybrid. All of their versions of these tools in the repos (the few they actually have) are 2+ years old and 4+ vesrions out of date. Why spend my time learning on out of date tools?

    So I tried in to install new stuff from source. That's when I found out that all of the backend stuff in the ubuntu 12.04 repos like Java and QT4 is too old to support new stuff.

    So I tried to upgrade. At which point I found that the devs had made hundreds, if not thousands, of versioning and pinning errors on the backend stuff in their repos which cause you to get stuck in a negative feedback loop and caused those packages to be un-upgradable.

    So, I had to gut 1/2 my system and go hybrid.

    And it all works.

    Even if it is rather hackalicious and cludgy in spots.

    And of course all of that was made so much easier by the fact that I have a strange version of dyslexia where I literally read at an 8th year colledge level and spell at 3rd grade level (tested); which is why my grammer, spelling and punctuation all looks like it was done by an idiot if I don't sit here and literally re-read eveything I type dozens and dozens of times. And then I still miss stuff which I just can't see until I come back and read it again a few hours later. Try scripting, coding and building with that little gem in your pocket!

    But, in all that hoo-ha I was unable to get your solution to this issue to work. My X (like everything else) is kind of weird.

    I don't have a conf or conf.d file. I can force a conf file on it, but then I'm stuck with it and I don't want that. So I tried shoehorning both the raw code and a conf.d file in to several reasonable looking spots that I figured wouldn't blow up my X server and tried some service restarts and reboots but I couldn't get the change to stick.

  9. #8
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,621
    I'm mildly dyslexic myself; nothing to extreme and I can usually tell when something isn't right as the words seem to float and are normally so wildly out of context that it doesn't make any sense at all. I am a programmer and find that I have no trouble reading or writing code. My doc reckons it's because I use a different part of my brain.

    If you don't have an /etc/xorg.conf file then you should just be able to create it. What I am unsure of as it has been a long time since I messed with xorg in depth is whether it can have only the snippet in it.
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  10. #9
    Linux User Steven_G's Avatar
    Join Date
    Jun 2012
    Location
    Western US
    Posts
    415
    Well from the way I understand it, and I may be wrong here, the way the newest X is currently working is that it no longer natively uses the xorg.conf config file but you can force one on it by running config. At which point you are stuck with the config file and then you are required to use it to make any modifications to X.

    This change is very recent. I am very reluctant to force an xorg.conf file on my system because that was one of the biggest things I had issues with while starting out. In addition to my brains being rattled my eyesight is not so great either. So I need to jack in to a TV in order to have a screen big enough to see. But, I have an Optimus video card and I had tons and tons of issues trying to get Optimus / BumbleeBee to export to an external monitor through the xorg.conf configuration set up. This problem was compounded greatly by the fact that my TV is HDMI. Under the old version of X I never did get it to work completely right. I was able to find and figure out some hackalicious stuff that looked like and worked like crap, was very unstable and I blew up too many times to count.

    The new version of X runs this setup like a charm and is *almost* plug and play.

    I'm kind of gun shy about tinkering too much with something that is so important to my set up that I blew up so many times while getting started; especially if it means forcing reversions on to my system that I know from experience are problematic for my configuration.

  11. #10
    Linux User Steven_G's Avatar
    Join Date
    Jun 2012
    Location
    Western US
    Posts
    415
    And on further investigation my current solution, though cludgy, is acceptable. I don't know what caused the transient spike in systems resource consuption when I first implemented this script. I *assumed* it was the script. But the timing now appears to be coincidential. After running some benchmarks I have determined that the CPU resource consumption is actually so low that my benchmark tool cannot even measure it. It registers zero percent on a 15 minute average. And it is only consuming 32MB RAM aggregate total in repetative 212KB stacking cache "chunks".

    That is more than acceptable to achieve what I want without having to force reversions on my X.

    But I appreciate you trying to help,

    Thanks.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •