When playing Flash video in Firefox, the screen saver is not disabled and so you are required to move your mouse every few minutes to prevent the screen saver from turning on. This is highly annoying. This guide provides a method to automatically disable the screen saver whenever Flash is being used in Firefox.
Note: This method disables the screen saver regardless of what type of Flash program is running. It doesn't discriminate between a Youtube video and a Punch the Monkey ad.
We are going to create a daemon that detects if the Flash shared library currently has any memory mapped. If it does, we disable the screen saver. If it doesn't, and we know that we previously disabled the screen saver, we turn it back on. First, we need to make sure we have a local bin directory:
Next, save the following script as ~/bin/flash_saver.sh:Code:mkdir -p ~/bin
Next, we make the script executable: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 we_turned_it_off=0 while true; do sleep 60 flash_on=0 for pid in `pgrep firefox` ; do if grep libflashplayer /proc/$pid/maps > /dev/null ; then flash_on=1 fi ss_on=`gconftool-2 -g /apps/gnome-screensaver/idle_activation_enabled` if [ "$flash_on" = "1" ] && [ "$ss_on" = "true" ]; then gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled \ --type bool false we_turned_it_off=1 elif [ "$flash_on" = "0" ] && [ "$ss_on" = "false" ] \ && [ "$we_turned_it_off" = "1" ]; then gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled \ --type bool true we_turned_it_off=0 fi done done
Now, we can turn it on by pressing F2 and running, "~/bin/flash_saver.sh". You can now either test it watching some Flash videos or just proceed to System->Preferences->Session and adding "flash_saver.sh" as one of your startup programs.Code:chmod +x ~/bin/flash_saver.sh
Watch some long Flash videos and verify that screen saver doesn't come on. Afterwards, close all tabs that have any Flash content on them and see if the screen saver now comes on as normal.