
screensaverpauser
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
pauses amarok on activating the kde screensaver
actually this alwyas works, if your screen is locked
13 years ago
Now even works with gnome, thanks again to scott!
Now works with 1.4.5 again, thanks to scottmuz77
Changed the things aalcock mentioned ;)
13 years ago
Now even works with gnome, thanks again to scott!
Now works with 1.4.5 again, thanks to scottmuz77
Changed the things aalcock mentioned ;)
webrat
11 years ago
Quote:
if [ $(qdbus org.kde.krunner /ScreenSaver org.freedesktop.ScreenSaver.GetActive) = "true" ];then
As KDE4 is no more using DCOP the Script fails without the change.
Report
scottmuz77
13 years ago
under Gnome.
I've updated the script to work with Gnome
which involved some slight refactoring.
Since amarok seems to popular with Gnome users I expect others would benefit from this.
Hurra if you are happy with this can you
check it still works in KDE as I don't have access to KDE.
Here it is inline as attachments don't seem to be supported (indentation seem to be lost also)
<<
#!/bin/bash
isScreenSaverBlanked () {
# Check if GNOME is running
if [ $GNOME_DESKTOP_SESSION_ID ]; then
isBlanked=$(dbus-send --reply-timeout=2000 --print-reply --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.GetActive 2>&1 | grep boolean | grep true)
if [ -n "$isBlanked" ];then
return 1
fi
else # assume KDE
if [ $(dcop kdesktop KScreensaverIface isBlanked) = "true" ];then
return 1
fi
fi
return 0
}
while [ true ];
do
isScreenSaverBlanked
if [ $? = 1 ];then
play_status=$(dcop amarok player status)
if [ $play_status = 2 ];then
$(dcop amarok player playPause)
fi
isScreenSaverBlanked
while [ $? = 1 ];
do
sleep 2
isScreenSaverBlanked
done
if [ $play_status = 2 ];then
$(dcop amarok player playPause)
fi
fi
sleep 5
done
>>
Report
scottmuz77
14 years ago
working for me when I upgraded
to amarok 1.4.5.
Replacing both occurences of
dcop amarok player pause
with
dcop amarok player playPause
fixes the problem.
Report
hurra
14 years ago
Report
aalcock
15 years ago
Two improvements:
The "sleep 1" is a bit quick for a script, I've upped it to 5 seconds,
There is a loop while the screen saver is on with no sleep at all. I changed mine to:
  b2=$(dcop kdesktop KScreensaverIface isBlanked)
  while [ $b2 = "true" ];
  do
        b2=$(dcop kdesktop KScreensaverIface isBlanked)
        sleep 2
  done
Report
hurra
15 years ago
Report
hurra
15 years ago
Report