Turning screensaver on and off in KDE

Sunday, February 15, 2009

One problem that have always bothered me on Linux is the screensaver starting up when you really don't want it. This happens for example when you're watching a movie, or playing a game exclusively on joystick.

This happens because of a combination of two reasons:
1) Both KDE and GNOME do not monitor joystick activity to keep the screensaver from activating. This has been reported as a BUG in Ubuntu.
2) Some applications do not block the startup of the screensaver (RealPlayer, SDLMAME, SDLMESS, games in wine ...)

Well, there is a solution that works very well on my Kubuntu. I have created two small scripts, one to turn off screensaver, and another one to turn it back on:

screensaver-off

#!/bin/bash

xset s off -dpms

dcop kdesktop KScreensaverIface enable false



screensaver-on
#!/bin/bash

xset s on +dpms

dcop kdesktop KScreensaverIface enable true





Just save these scripts in your directory "/usr/bin/" and give permission to execute:

sudo chmod +x /usr/bin/screensaver-off
sudo chmod +x /usr/bin/screensaver-on


After this procedure, just modify the shortcut of your problematic applications, so they will turn off the screensaver on start, and turn it on again after exit.

For example, the shortcut to your favorite game in SDLMAME, which was:

xmame mygame

will now look like this:

screensaver-off; xmame mygame; screensaver-on

Have fun without having to move your mouse every 10 minutes! :)

Read more...

Desligando e Ligando o screensaver no KDE

Um dos problemas que sempre encontrei no Linux é o screensaver acionando sem você querer. Isso acontece por exemplo quando você está assistindo um filme, ou jogando um jogo exclusivamente no joystick.

Isto acontece por uma combinação de duas razões:
1) Tanto o KDE quanto o GNOME não monitoram a atividade do joystick para impedir o acionamento do screensaver. Isto já foi reportado como BUG no Ubuntu.
2) Alguns aplicativos não bloqueiam a inicialização do screensaver (RealPlayer, SDLMAME, SDLMESS, jogos no wine...)

Bem, existe uma solução que funciona muito bem no meu Kubuntu. Criei dois pequenos scripts, um para ligar e outro para desligar o screensaver:

screensaver-off

#!/bin/bash

xset s off -dpms

dcop kdesktop KScreensaverIface enable false



screensaver-on
#!/bin/bash

xset s on +dpms

dcop kdesktop KScreensaverIface enable true





Basta salvar estes scripts em seu diretório "/usr/bin/" e dar permissão de execução:

sudo chmod +x /usr/bin/screensaver-off
sudo chmod +x /usr/bin/screensaver-on


Após este procedimento, basta modificar o atalho de seus aplicativos problemáticos, de forma que eles desliguem o screensaver ao iniciar, e liguem novamente ao serem terminados.

Por exemplo, o atalho para seu jogo favorito no SDLMAME, que era assim:

xmame mygame

vai ficar assim:

screensaver-off;xmame mygame;screensaver-on

Divirta-se, sem ter que mexer no mouse a cada 10 minutos! :)

Read more...
Easy-Share


template by Ourblogtemplates.com
©Copyright 2009, Cleber de Mattos Casali. All rights reserved.