Just wanted to say that post #16 from TheLasko worked like a charm. Huge thanks as this was a big gripe of mine.
Just wanted to say that post #16 from TheLasko worked like a charm. Huge thanks as this was a big gripe of mine.
My recommended method for installing UbuntuStudio.
Yes, I use 64-bit.
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.
Happy watching youtube, vimeo and whatever flash movieCode:#!/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![]()
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.
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.Code:gnome-screensaver-command -a
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
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.
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
Thanks Super R, your script works great.
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?
Bookmarks