Topic: Script to start/stop screensaver

Hello, I would like to figure out a way to create a simple script to temporary disable xscreensaver and power-manager screensaver. The point in that is that I want to be able to automatize the things I need to do in order to watch longer flash videos without interruption from the screensaver. Can anyone help me?

Re: Script to start/stop screensaver

I'm not sure if this is anything like what you want but I have this in my autostart.sh

#no blank screen
xset s off && xset -dpms &

and it works. the screen doesn't blank out (I have no xscreensaver or other screensaver running)

registered Linux user: #533379
registered #! user: #6769
Whenever someone calls me a computer 'nerd' or a 'Unix-based-system'
all I can think is: You just wait. In a couple of years. I'll be your IT. Then where will you be!

Re: Script to start/stop screensaver

So what you're looking for is a script that kills xscreensaver & xfce4-power-manager before you watch the Flash video, then restarts them after you're done?

Why not make it simple and use two - one to kill them, another to restart them?

#!bin/bash
pkill xscreensaver &
pkill xfce4-power-manager &
#!bin/bash
xfce4-power-manager &
xscreensaver -no-splash &

Easy peasy!

EDIT:  `pkill xfce4-power-manager` won't work...this should do better:

#!bin/bash
pkill xscreensaver
kill `pidof xfce4-power-manager`

Also, you shouldn't need the ampersands in the kill script.

re-EDIT:  Shortened the code a little.

Last edited by pvsage (2011-05-08 16:11:15)

while ( ! ( succeed = try() ) );

Re: Script to start/stop screensaver

Thank you guys. I wanted to use a single shortcut to turn the script on/off. Is it possible for the scripts pvsage wrote?

Re: Script to start/stop screensaver

OK, so you want an if-then-else script to toggle them on and off.  Here's a quick-and-dirty one:

#!/bin/bash
if [ "$(pidof xfce4-power-manager)" ]
then
   pkill xscreensaver
   kill `pidof xfce4-power-manager`
else
   xfce4-power-manager &
   xscreensaver -no-splash &
fi

This is easiest to monitor if you have xfce4-power-manager set to always display an icon in the systray...if the icon isn't there, the power manager is down.

EDIT:  Forgot the root slash in the hashbang... roll

re-EDIT:  I just tested this on my netbook, and it works.  Don't forget to put it in your path (I prefer ~/bin) and make it executable.  Bind it to a keyboard shortcut...wax on, wax off.

Last edited by pvsage (2011-05-08 16:54:45)

while ( ! ( succeed = try() ) );

Re: Script to start/stop screensaver

Thank you, pvsage!

Re: Script to start/stop screensaver

Maybe 'xscreensaver-command' that comes with xscreensaver can do some of this stuff for you:
http://www.jwz.org/xscreensaver/man3.html
http://www.jwz.org/xscreensaver/faq.html

Last edited by johnraff (2011-05-11 05:14:18)

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: Script to start/stop screensaver

Hello, it seems like simply killing xscreensaver and xfce4-power-manager is not doing the trick - I found that the xset s off -dpms is doing the job, how to implent that into the script so that it is working with xset s off -dpms and xset s on +dpms?