You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, August 1st 2007, 2:24pm

[kaffeine] Screensaver starts when I watch a video [open]

Hi all, when I am watching a film on kaffeine, screensaver starts and I have to move the mouse periodically.Is there an option to disable the screensaver while I am watching a movie?

Thanks....

______________
Gentoo 2007.0
Kde 3.5.5
kaffeine 0.8.3

2

Tuesday, June 16th 2009, 1:09pm

screen saver kaffeine?

Basically .kde/share/config has some rc files that control screen saver power management of monitor - upon update krunner needs to be restarted
(this is all done via automated script below which runs on crontab and disables - screensaver powermanagement whilst u watch listen to audio)
You can modify as you like
I need to make a new version so it only stops locking screen for amarok this way I can still use remote control to control sound without having to enter password but I don't mind screen saver - for films it can remain in this current script so the new script would be a different if loop for amarok and films would remain as they are...

back to script...


As a default setup i preusme powerdevil and kscreensaver are used:

feel free to remove config for krandtray and kpowersave they are there just incase you use different methods to control PM.

in your home folder open a shell
mkdir scripts
cd scripts
first do
env|grep DISPLAY (ensure the display number matches first line of script also update username to match your username and make sure home folder paths etc match up to your setup)
then

vi watching-film.sh
esc i [ insert mode copy paste below into it then :wq then chmod 755 ./watching-films.sh and follow crontab entry below]

#!/bin/sh

export DISPLAY=:0
username="YOUR_USERNAME";
home="/home/$username";
rcfile="$home/.kde/share/config/kscreensaverrc";
powerdevil="$home/.kde/share/config/powerdevilprofilesrc";
kpowersave="$home/.kde/share/config/kpowersaverc";
krand="$home/.kde/share/config/kcmdisplayrc";

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

pp=`pgrep "(mplayer|kplayer|kaffeine|totem|kmplayer|dragon|amarok)" -d1`
if [ $pp > 0 ]
then
echo "checking Screensaver status";
#Disable kde-screensaver
ENABLED=`cat $rcfile |grep "^Enabled="|awk -F"^Enabled=" '{print $2}'`
if [ "$ENABLED" = "true" ]
then
echo "1"
ed -s $rcfile <<EOF
g/^Enabled=true/s/^Enabled=true/Enabled=false/g
g/^Lock=true/s/^Lock=true/Lock=false/g
.
w
q
EOF
echo "$rcfile disabled Lock=false Enabled=false"

if test -e $powerdevil
then
ed -s $powerdevil <<EOF
g/^DPMSEnabled=true/s/^DPMSEnabled=true/DPMSEnabled=false/g
.
w
q
EOF
echo "$powerdevil disabled DPMSEnabled=false"
fi

if test -e $krand
then
ed -s $krand <<EOF
g/^displayEnergySaving=true/s/^displayEnergySaving=true/displayEnergySaving=false/g
.
w
q
EOF
echo "$krand disabled - displayEnergySaving=false"
fi



num1=`grep -n specSsSettings=true $kpowersave |awk -F":" '{print $1}'`
if [ $num1 > 0 ]
then
ed -s $kpowersave <<EOF
$num1,$num1 d
w
q
EOF
echo "$kpowersave disabled specSsSettings=true removed"
fi

#Restart Krunner to pickup new config
killall krunner;
nohup /usr/bin/krunner
fi
else
ENABLED=`cat $rcfile |grep "^Enabled="|awk -F"^Enabled=" '{print $2}'`
if [ "$ENABLED" = "false" ]
then
ed -s $rcfile <<EOF
g/^Enabled=false/s/^Enabled=false/Enabled=true/g
g/^Lock=false/s/^Lock=false/Lock=true/g
.
w
q
EOF
echo "$rcfile restored Lock=true Enabled=true "

if test -e $powerdevil
then
ed -s $powerdevil <<EOF
g/^DPMSEnabled=false/s/^DPMSEnabled=false/DPMSEnabled=true/g
.
w
q
EOF
echo "$powerdevil restored DPMSEnabled=true"
fi


if test -e $krand
then
ed -s $krand <<EOF
g/^displayEnergySaving=false/s/^displayEnergySaving=false/displayEnergySaving=true/g
.
w
q
EOF
echo "$krand restored displayEnergySaving=true"
fi


#Restart Krunner to pickup new config
killall krunner;
nohup /usr/bin/krunner
echo "config changed - screensaver enabled"
fi

fi

############################################
:wq

then chmod 755 /home/USERNAME/scripts/watching-film.sh
crontab -l
# m h dom mon dow command
*/1 * * * * /home/USERNAME/scripts/watching-film.sh > /dev/null

add above crontab entry and screen saver is now controlled via this script

thanks
vahid

This post has been edited 6 times, last edit by "masterv" (Jun 19th 2009, 5:04pm)


3

Friday, June 19th 2009, 5:47pm

Kde Screensaver and Powermanagement different settings for different typs of applications

I kind of wish I had not continued this in shell and written it in perl.

anyways this is the updated version..

There is a section for audio then a section for video

The reason for the devision is I don't mind screen saver for audio - it means one extra press on remote control to get screen back - but if it locks it requires a password to allow remote to control again. this can be annoying if you have it set to every minute.

Anyways feel free again to add or alter things you wish to disable for each mode I have removed kpowersave and krand since as standard its powerdevil and kscreensaver.

Here is updated script - only change is audio stuff still screen saver but no locks again update the media list to other applications or remove if you only wish actions for specific apps.

#!/bin/sh


export DISPLAY=:0
username="nutter";
home="/home/$username";
rcfile="$home/.kde/share/config/kscreensaverrc";
powerdevil="$home/.kde/share/config/powerdevilprofilesrc";
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
detected="$home/scripts/.audiorunning"
audio=`pgrep "(audacious|amarok|xmms|rhythmbox|exaile|banshee|juk)" -d1`
video=`pgrep "(mplayer|kplayer|kaffeine|totem|kmplayer|dragon)" -d1`

if [ $audio > 0 ]
then
LOCK=`cat $rcfile |grep "^Lock=true"|awk -F"^Lock=" '{print $2}'`
if [ "$LOCK" = "true" ]
then
echo "disabling screen lock"
ed -s $rcfile <<EOF
g/^Lock=true/s/^Lock=true/Lock=false/g
.
w
q
EOF
#create a file to remind your removal to reset the lock
touch $detected
echo "$rcfile disabled Lock=false"

#Restart Krunner to pickup new config
killall krunner;
nohup /usr/bin/krunner
fi
else
if test -e $detected
then
UNLOCK=`cat $rcfile |grep "^Lock="|awk -F"^Lock=" '{print $2}'`
if [ $UNLOCK = "false" ]
then
ed -s $rcfile <<EOF
g/^Lock=false/s/^Lock=false/Lock=true/g
.
w
q
EOF
#remove temp file to stop loop
rm $detected
echo "$rcfile restored Lock=true"
#Restart Krunner to pickup new config
killall krunner;
nohup /usr/bin/krunner
echo "config changed - screensaver enabled"
fi
fi
fi


if [ $video > 0 ]
then
echo "checking Screensaver status";
#Disable kde-screensaver
ENABLED=`cat $rcfile |grep "^Enabled="|awk -F"^Enabled=" '{print $2}'`
if [ "$ENABLED" = "true" ]
then
ed -s $rcfile <<EOF
g/^Enabled=true/s/^Enabled=true/Enabled=false/g
g/^Lock=true/s/^Lock=true/Lock=false/g
.
w
q
EOF
echo "$rcfile disabled "

if test -e $powerdevil
then
ed -s $powerdevil <<EOF
g/^DPMSEnabled=true/s/^DPMSEnabled=true/DPMSEnabled=false/g
.
w
q
EOF
echo "$powerdevil disabled DPMSEnabled=false"
fi

#Restart Krunner to pickup new config
killall krunner;
nohup /usr/bin/krunner
fi

else
ENABLED=`cat $rcfile |grep "^Enabled="|awk -F"^Enabled=" '{print $2}'`
if [ "$ENABLED" = "false" ]
then
if test -e $detected
then
ed -s $rcfile <<EOF
g/^Enabled=false/s/^Enabled=false/Enabled=true/g
.
w
q
EOF
echo "$rcfile restored Lock=false (audio running) Enabled=true "
else
ed -s $rcfile <<EOF
g/^Enabled=false/s/^Enabled=false/Enabled=true/g
g/^Lock=false/s/^Lock=false/Lock=true/g
.
w
q
EOF

echo "$rcfile restored Lock=true Enabled=true "
fi
if test -e $powerdevil
then
ed -s $powerdevil <<EOF
g/^DPMSEnabled=false/s/^DPMSEnabled=false/DPMSEnabled=true/g
.
w
q
EOF
echo "$powerdevil restored DPMSEnabled=true"
fi



#Restart Krunner to pickup new config
killall krunner;
nohup /usr/bin/krunner
echo "config changed - screensaver enabled"
fi
fi

This post has been edited 1 times, last edit by "masterv" (Jun 19th 2009, 8:55pm)