Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto: disable the screensaver when Hulu Desktop is running
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
LMCBoy
Apprentice
Apprentice


Joined: 30 Aug 2002
Posts: 191
Location: San Ramon, CA

PostPosted: Mon Sep 20, 2010 5:29 am    Post subject: Howto: disable the screensaver when Hulu Desktop is running Reply with quote

This falls into the I-can't-believe-it's-so-difficult-to-do-this-obvious-thing category: How to inhibit the screensaver while an application (Hulu in this case) is running.

This is just one solution to this problem; it involves writing a 4-line shell script to serve as a wrapper for the application. I also investigated using the "inhibit" DBUS function, which exists, but no permutation of its arguments had any effect as far as I could tell (i.e., the screensaver always timed out normally no matter what I tried with qdbus). These instructions assume a KDE4 desktop.

Step 1: from the KDE menu, search for "hulu" (or whatever your desired no-screensaver application is), and drag the icon onto your plasma workspace (aka desktop). This will eventually serve as the quick-launch button for the wrapper.

Step 2: Write the shell script, save it as /usr/local/bin/huluwrapper.sh:

Code:
#!/bin/bash                                                                     
huludesktop &
sleep 15
wid=`xwininfo -name "Hulu Desktop" | awk '/Window id/ {print $4}'`
xdg-screensaver suspend $wid


Step 3: chmod +x /usr/local/bin/huluwrapper.sh

Step 4: Hover mouse on your hulu desktop icon, select the "edit" wrench icon. In the Application tab, change the "Command" field to /usr/local/bin/huluwrapper.sh

Step 5: Bummer: this removes the Hulu icon, replaces it with a default "unknown" icon. You can change this in the General tab of the same edit dialog. Click the icon, and select a new one from the wide array of KDE icons. I used "video-television", under "Devices".

Step 6: There is no step 6! Try it out. When Hulu is running: no screensaver. As soon as Hulu exits, screensaver timeouts resume.


I would also like to add a simple plasma widget that toggles the screensaver on/off, but that is beyond my available free time at the moment.

Anyone have a better way of doing this?
_________________
LMCBoy
Back to top
View user's profile Send private message
Muso
Veteran
Veteran


Joined: 22 Oct 2002
Posts: 1002
Location: The Holy city of Honolulu

PostPosted: Mon Sep 20, 2010 6:28 am    Post subject: Reply with quote

Damn.

I find it easier to just use a wm that doesn't launch any sort of screensaver.
(hint, use e17)
_________________
"You can lead a horticulture but you can't make her think" ~ Dorothy Parker
"It's not a big truck. It's a series of tubes." ~ Senator Ted Stevens describing the Internet
Back to top
View user's profile Send private message
gentoo-dev
Apprentice
Apprentice


Joined: 24 Jan 2006
Posts: 172

PostPosted: Mon Sep 20, 2010 10:44 am    Post subject: Reply with quote

Never heard of this lulu, don't use KDE, I just run 'xset s off'
Back to top
View user's profile Send private message
LMCBoy
Apprentice
Apprentice


Joined: 30 Aug 2002
Posts: 191
Location: San Ramon, CA

PostPosted: Mon Sep 20, 2010 2:13 pm    Post subject: Reply with quote

I guess I should have known that the only replies would be anti-KDE advocacy...
:roll:
_________________
LMCBoy
Back to top
View user's profile Send private message
nordic bro
Guru
Guru


Joined: 25 Oct 2003
Posts: 582

PostPosted: Mon Sep 20, 2010 4:41 pm    Post subject: Reply with quote

what I'd do is a daemon shell script:

Code:
if ! screensaver exit else save screensaver state
while 1
  ps list of processes for desired item(s)
  if true kill screensaver else sleep
end

or something like that. somewhere you'd want to have initial screensaver state restored when ps fails.

I use a single session startup script to load things when booting so I'd initiate it from there. and I usually create a flag (file in /tmp) for these kinds of things such that they can only be started once.

doing it like this means you don't need to write new launchers, just add the processes to the list for ps to check.
Back to top
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Mon Sep 20, 2010 6:57 pm    Post subject: Reply with quote

Moved from Desktop Environments to Documentation, Tips & Tricks as it fits here better.
_________________
Search | Read | Answer | Report | Strip
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum