Page 4 of 5 FirstFirst ... 2345 LastLast
Results 31 to 40 of 46

Thread: HOWTO: Disable screen saver while Flash is running

  1. #31
    Join Date
    Jul 2009
    Beans
    3

    Re: HOWTO: Disable screen saver while Flash is running

    Just wanted to say that post #16 from TheLasko worked like a charm. Huge thanks as this was a big gripe of mine.

  2. #32
    Join Date
    Aug 2007
    Location
    Chicago, IL, USA
    Beans
    1,429
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: Disable screen saver while Flash is running

    Quote Originally Posted by brott8 View Post
    Just wanted to say that post #16 from TheLasko worked like a charm. Huge thanks as this was a big gripe of mine.
    Thanks, I'm still using that version of the script as well. I do have some occasional problems with it though. Sometimes the screensaver doesn't seem to resume after I close flash from full screen. I haven't been able to resolve that issue.

  3. #33
    Join Date
    May 2009
    Location
    Gelsenkirchen, Germany
    Beans
    113

    Re: HOWTO: Disable screen saver while Flash is running

    Quote Originally Posted by Thelasko View Post
    Thanks, I'm still using that version of the script as well. I do have some occasional problems with it though. Sometimes the screensaver doesn't seem to resume after I close flash from full screen. I haven't been able to resolve that issue.
    same here, after the script has run for one time, suspend does not work at all...
    everything seems to be set right, but nevertheless, my PC doesnt go to suspend at all..

    If i click "suspend" with my mouse, then it does...
    but no longer automatically...

  4. #34
    Join Date
    Mar 2005
    Beans
    72

    Re: HOWTO: Disable screen saver while Flash is running

    Quote Originally Posted by javajesse View Post
    Its a manual click, but I use the Inhibit Applet on the Panel. Quick and easy to disable / enable screensaver & sleep.
    This is a nice solution.. I would think that this would be done "properly" in the flash plugin sooner or later, but this works well for the moment.

  5. #35
    Join Date
    Nov 2009
    Beans
    14

    Re: HOWTO: Disable screen saver while Flash is running

    I've edited the script from post #16, so that it works for Chrome, Opera or whatever browser which use libflashplayer. It checks to see if the window in focus is the flashplayer(flashplayer is in focus when flashplayer are running in full screen). This way, commercials or other flash content, will not disable the screen saver(when the program in focus are running full screen, which might be another program). A video which is not in full screen, will not disable the screen saver either. Not sure how to test this(seen some scripts which looks for a file in /tmp, but it doesn't always work.) But hey, if I'm watching a video over several minutes, I'm probably having it blown up full screen.

    I've also changed the "sleep 60" to "sleep 30", for those who have set the screen saver time limit to 60 seconds. The rest should be the same.

    Code:
    #!/bin/bash
    
    # cleanup any bad state we left behind if the user exited while flash was running
    gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type bool true
    
    turn_it_off=0
    sleepcomputer0=`gconftool-2 -g /apps/gnome-power-manager/timeout/sleep_computer_ac`
    sleepdisplay0=`gconftool-2 -g /apps/gnome-power-manager/timeout/sleep_display_ac`
    
    # run loop forever
    while true; do
      # interval between checks
      sleep 30
      SS_off=0
      # make id variable of window in focus
      current_window_id=`xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | cut -d" " -f5`
      # make pid array of every command with libflashplayer in full(-f) command
      for pid in `pgrep -f libflashplayer` ; do
        # check if window in focus is our libflashplayer
        if [ $pid == `xprop -id $current_window_id | grep PID | cut -d" " -f3` ]
          then SS_off=1
        fi
      done
    
    # check to see if xine is being used
    #  if pgrep xine > /dev/null; then
    #    SS_off=1
    #  fi
    #
    # check to see if current application is fullscreen
    #  current_window_id=`xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | cut -d" " -f5`
    #  if xprop -id $current_window_id | grep "_NET_WM_STATE_FULLSCREEN" > /dev/null; then
    #    SS_off=1
    #  fi
    
      # read current state of screensaver
      ss_on=`gconftool-2 -g /apps/gnome-screensaver/idle_activation_enabled`
    
      # change state of screensaver as necessary
      if [ "$SS_off" = "1" ] && [ "$ss_on" = "true" ]; then
        gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type bool false
        gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_computer_ac --type int 0
        gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_display_ac --type int 0
        turn_it_off=1
      elif [ "$SS_off" = "0" ] && [ "$ss_on" = "false" ] && [ "$turn_it_off" = "1" ]; then
        gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type bool true
        gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_computer_ac --type int $sleepcomputer0
        gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_display_ac --type int $sleepdisplay0
        turn_it_off=0
      fi
    done
    Happy watching youtube, vimeo and whatever flash movie

  6. #36
    Join Date
    Apr 2008
    Beans
    11
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: Disable screen saver while Flash is running

    First of all, this script is great!!! This is a fairly old thread so I am not sure if anyone is still interested. BUT I had the problem where gnome-screensaver does not come back on after returning from full screen.

    I believe that I have found a sloppy fix for this. Keep in mind that I am using this script for ALL fullscreen windows rather than for fullscreen flash windows. I don't think it matters, just thought I would mention it.

    Adding the following line after the screensaver value returns to true seems to work every time.

    Code:
    gnome-screensaver-command -a
    The only downside to this would be that the screensaver comes on as soon as the value is set to true rather than waiting for your screensaver to activate on its own.

    Anyway, here is the code I use. A couple things didn't apply to my setup so I commented them out. Thank you so much for posting this as it is a huge annoyance that is now solved for me

    Code:
    #!/bin/bash
    
    # cleanup any bad state we left behind if the user exited while flash was running
    gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type bool true
    
    turn_it_off=0
    #sleepcomputer0=`gconftool-2 -g /apps/gnome-power-manager/timeout/sleep_computer_ac`
    #sleepdisplay0=`gconftool-2 -g /apps/gnome-power-manager/timeout/sleep_display_ac`
    
    # run loop forever
    while true; do
      # interval between checks
      sleep 30
      SS_off=0
      # make id variable of window in focus
      #current_window_id=`xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | cut -d" " -f5`
      # make pid array of every command with libflashplayer in full(-f) command
      #for pid in `pgrep -f libflashplayer` ; do
        # check if window in focus is our libflashplayer
        #if [ $pid == `xprop -id $current_window_id | grep PID | cut -d" " -f3` ]; then 
        	#SS_off=1
        #fi
      #done
    
    # check to see if vlc is being used
    #  if pgrep vlc > /dev/null; then
    #    SS_off=1
    #  fi
    #
    # check to see if current application is fullscreen
      current_window_id=`xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | cut -d" " -f5`
      if xprop -id $current_window_id | grep "_NET_WM_STATE_FULLSCREEN" > /dev/null; then
        SS_off=1
      fi
    
      # read current state of screensaver
      ss_on=`gconftool-2 -g /apps/gnome-screensaver/idle_activation_enabled`
    
      # change state of screensaver as necessary
      if [ "$SS_off" = "1" ] && [ "$ss_on" = "true" ]; then
        gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type bool false
        #gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_computer_ac --type int 0
        #gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_display_ac --type int 0
        turn_it_off=1
      elif [ "$SS_off" = "0" ] && [ "$ss_on" = "false" ] && [ "$turn_it_off" = "1" ]; then
        gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type bool true
        gnome-screensaver-command -a
        #gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_computer_ac --type int $sleepcomputer0
        #gconftool-2 -s /apps/gnome-power-manager/timeout/sleep_display_ac --type int $sleepdisplay0
        turn_it_off=0
      fi
    done

  7. #37
    Join Date
    Nov 2009
    Beans
    14

    Re: HOWTO: Disable screen saver while Flash is running

    Quote Originally Posted by Super R View Post
    First of all, this script is great!!! This is a fairly old thread so I am not sure if anyone is still interested.
    I am aware of the oldness of this thread, but as many others, this is still a immense annoyance in Ubuntu/Linux Mint(at least in LM 10, as I am using).

    I think this is because there isn't a "right" way of doing it. libflashplayer should not have rights to change screensavers settings on it's own(security), libflashplayer is closed source, and so on. And the problem falls into the bike-shed category(a must read: http://www.bikeshed.com/).

    Still, this is the thread that you will find, if you search for "disable screen saver flash ubuntu". I think the first post should be edited to reflect that, reading through all the pages is time taking(I know, anything worth knowing, is time taking). Anyhow, this is such a thing that I expect to "just work". I'm not sure if there is some administrative restrictions to editing the first post?

    And, yes, thanks for your input, Super R.

  8. #38
    Join Date
    Apr 2008
    Beans
    11
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: Disable screen saver while Flash is running

    Hello again. After playing with the script in my last post for a while, I was experiencing strange behaviour when I would wake up the screensaver after a cycle...it would go right back to sleep again. Waking it up the second time did the trick, but it was a slight annoyance. So I decided to try a different approach and use gnome-screensaver-command to inhibit the screensaver. I thought that it may be a "better way" to do this whole thing.

    Below you will find a revised script (again) that uses gnome-screensaver-command to inhibit the screensaver when any window is fullscreen and kills gnome-screensaver-command when the window becomes regular again. It is the most perfect solution I have found so far (and I have been looking for a solution to this problem for 5 years) as it is automatic and care-free. Enjoy!!

    Code:
    #!/bin/bash
    
    turn_it_off=0
    
    while true; do
      sleep 30
      SS_off=0
     
      current_window_id=`xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | cut -d" " -f5`
      if xprop -id $current_window_id | grep "_NET_WM_STATE_FULLSCREEN" > /dev/null; then
        SS_off=1
      fi
    
      pidof gnome-screensaver-command
      if [ "$SS_off" = "1" ] && [ $? -le 0 ] && [ "$turn_it_off" = "0" ]; then
      	gnome-screensaver-command -i &
      	turn_it_off=1  	
      elif [ "$SS_off" = "0" ] && [ "$turn_it_off" = "1" ]; then
      	killall gnome-screensaver-command
      	turn_it_off=0
      fi
    done

  9. #39
    Join Date
    Mar 2006
    Beans
    251

    Re: HOWTO: Disable screen saver while Flash is running

    Thanks Super R, your script works great.

  10. #40
    Join Date
    Nov 2009
    Location
    KCMO
    Beans
    201
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: Disable screen saver while Flash is running

    I was wondering if this solution works fine in 10.04 and if it works like Totem does when it suppresses the screen saver. Specifically, does the screen saver come back on if the video is paused?

Page 4 of 5 FirstFirst ... 2345 LastLast

Bookmarks

Posting Permissions

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