screensaverpauser

Amarok 1.x Scripts

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

0
Score 50.0%
Description:

pauses amarok on activating the kde screensaver

actually this alwyas works, if your screen is locked
Last changelog:

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

10 years ago

to get the script working with kde4 and amarok 1.4 you need to change line 11 to
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

I've recently had to use Amarok
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

13 years ago

This script is great but it stopped
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

C

hurra

13 years ago

Thanks, i made a new version.

Report

aalcock

15 years ago

Very useful script - It works fine for me.

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

C

hurra

15 years ago

Thanks, i made a new version, with the changes ;)

Report

C

hurra

15 years ago

Very nice ;)

Report

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 ;)

12345678910
product-maker Base: 4 x 5.0 Ratings
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
0.5
updated Apr 03 2007
added Apr 23 2005
downloads 24h
0
mediaviews 24h 0
pageviews 24h 0
System Tags addon