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: 464

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)

Offline

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

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

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)

Offline

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

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

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: 13,970

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)

Offline

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

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

Re: Script to start/stop screensaver

Thank you, pvsage!

Offline

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

johnraff
nullglob
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 4,148
Website

Re: Script to start/stop screensaver

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

Offline

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

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

Re: Script to start/stop screensaver

Offline

#9 2015-06-13 18:52:56

pvn
New Member
Registered: 2014-05-12
Posts: 2

Re: Script to start/stop screensaver

Last edited by pvn (2015-06-13 18:53:12)

Offline

#10 2015-06-13 19:01:28

Head_on_a_Stick
CatMod
From: A world of pure imagination
Registered: 2014-01-21
Posts: 4,797

Re: Script to start/stop screensaver

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.
Server: bleh

Debian Logo