SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2011-05-08 13:29:20

bozhkov
#! Junkie
Registered: 2009-12-29
Posts: 463

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?

Offline

Be excellent to each other!

#2 2011-05-08 15:37:59

crunchy
#! Junkie
From: Juneau, AK, USA
Registered: 2010-08-19
Posts: 461

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!

Offline

#3 2011-05-08 16:01:46

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 9,251

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() ) );
We've earned a reputation as a nice, friendly community; please help us keep it that way.

Offline

#4 2011-05-08 16:07:06

bozhkov
#! Junkie
Registered: 2009-12-29
Posts: 463

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?

Offline

#5 2011-05-08 16:19:14

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 9,251

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() ) );
We've earned a reputation as a nice, friendly community; please help us keep it that way.

Offline

#6 2011-05-08 19:03:00

bozhkov
#! Junkie
Registered: 2009-12-29
Posts: 463

Re: Script to start/stop screensaver

Thank you, pvsage!

Offline

#7 2011-05-11 05:14:04

johnraff
#!Drunkard
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,497
Website

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 )

Offline

#8 2011-05-18 07:58:28

bozhkov
#! Junkie
Registered: 2009-12-29
Posts: 463

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?

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo