Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 3 down vote accepted
$ cat ~/bin/hulu-suspend
#!/bin/sh
# wrapper for gnome-screensaver-command utility to inhibit and 
# refrain from inhibiting screensaver. comments and robustness
# are sacrificed for simplicity

case $0 in
    *suspend*) 
        gnome-screensaver-command --application-name Hulu \
            --reason "watchin stuffs" --inhibit & 
        gnome-screensaver-command --query ;;
    *resume*) 
        killall gnome-screensaver-command;
        gnome-screensaver-command --query ;;
    *) echo "usage $0: read the script $0"; exit 1;;
esac
$ 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.

share|improve this answer
    
Hmm, I didn't even think about backgrounding the blocking command. I'll try this tonight and accept it if it works. –  Rob Sep 30 '10 at 14:43
    
This doesn't seem to work from the .huludesktop file. I think that it needs a DISPLAY=:0 ENV variable or else the gnome-screensaver-command errors: ** Message: Failed to connect to the D-BUS daemon: /bin/dbus-launch terminated abnormally with the following error: Autolaunch error: X11 initialization failed. –  Rob Oct 4 '10 at 15:50
    
adding this line above the case statement causes the script to work for me in 10.04. export DISPLAY=:0; –  Rob Oct 13 '10 at 14:10

FYI, Caffeine 2.2 now has an option to hide the tray icon:

alt text

To open the preferences again once the icon is hidden, run caffeine -p from
the command line or System -> Preferences -> Caffeine Preferences.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.