Ubuntu – Disable Screensaver While Using Hulu Desktop


There is a file in your home folder that allows you to configure some settings for Hulu Desktop: ~/.huludesktop. It has an option for scripts to run to dis/en-able the screensaver.

I would like to write a script to be called by Hulu while watching video. It seems that in Ubuntu 10.04 the gconftool settings idle_activation_enabled & idle_activation_enabled no longer inhibit the gnome-screensaver or monitor sleep.

These are the commands I tried to use:

gconftool-2 --set /apps/gnome-screensaver/idle_activation_enabled --type bool TRUE
gconftool-2 --set /apps/gnome-powermanager/idle_activation_enabled --type bool TRUE

I have also found gnome-screensaver-command with the --inhibit option, but that blocks while active which means that my suspend script would be hard to fit into the two .huludesktop options (suspend_script & resume_script)

I would prefer not to use Caffine as this is under Ubuntu NBR and top panel space is valuable.

Best Answer

$ cat ~/bin/hulu-suspend
# wrapper for gnome-screensaver-command utility to inhibit and 
# refrain from inhibiting screensaver. comments and robustness
# are sacrificed for simplicity

case $0 in
        gnome-screensaver-command --application-name Hulu \
            --reason "watchin stuffs" --inhibit & 
        gnome-screensaver-command --query ;;
        killall gnome-screensaver-command;
        gnome-screensaver-command --query ;;
    *) echo "usage $0: read the script $0"; exit 1;;
$ chmod +x ~/bin/hulu-suspend
$ ln ~/bin/hulu-suspend ~/bin/hulu-resume
$ hulu-suspend
The screensaver is being inhibited by:
Application="Hulu"; Since="2010-09-30T03:30:15.169875Z"; 
    Reason="watchin stuffs";
$ ln ~/bin/hulu-suspend ~/bin/hulu-resume
$ ~/bin/hulu-resume
The screensaver is not inhibited

It's been tested; it claims to work. Enjoy.