sleepy (shutdown script)
Amarok 2.x Scripts
Score 54%
Description:

Sleep script like the old Nightingale. At the moment sleepy supports suspend, hibernate, shutdown and stopping amarok.
Also supports to turn off the screen when enabled. This option will lock the screen and turn it off after 10 seconds.
Last changelog:

8 years ago

0.9.3
Added dutch and czech translations
0.9.2
Made translations possible and added french translation
0.9.1
Fixed some typos (thanks bashlnx!)
0.9
- Use Hal now to suspend, hibernate and shutdown. This means (hopefully) that sleepy also works for users who don't have a full kde installation.
- Added the option to quit Amarok.
- There are 2 categories of actions now: General and Amarok actions, both can be set independly.
0.8.2
fixed the pause function before shutting down.
0.8.1
fixed a bug in turn the screen off.
0.8
added the option to turn off the screen.
0.7.1
support for stopping amarok
custom messages for each action
0.7
support for shutdown
0.6
support for suspend and hibernate
triggers are: time based, songs played, play stopped.

evilblade

3 years ago

Is there ANY way to make this script enabled automatically on amarok's startup? Please, I really need it :)

Report

poomerang

6 years ago

Hi,
are you still mantaining this script?
It should be updated as hal is getting deprecated: it's no more in use in KDE 4.6 (so for instance Kubuntu 11.04 doesn't install hal) in Gnome and in Xfce 4.8.
Major distributions are planning to drop or have already dropped it (see http://wiki.debian.org/HALRemoval https://wiki.ubuntu.com/Halsectomy http://fedoraproject.org/wiki/Features/HalRemoval)

ConsoleKit might be a replacement but i'm not quite sure

Greetings, and thanks for the script anyways!

Report

poomerang

6 years ago

consolekit should work at least for shutdown/restart, see http://www.freedesktop.org/software/ConsoleKit/doc/ConsoleKit.html#Manager

no clues about suspend/hibernate though

Report

poomerang

6 years ago

the solution for suspend/hibernate should be Upower http://upower.freedesktop.org/docs/UPower.html

Report

poomerang

6 years ago

and my soliloquy ends (finally) with the patch needed:

--- action.js 2010-08-23 16:25:33.000000000 +0200
+++ action2.js 2011-09-15 12:19:23.932470146 +0200
@@ -27,17 +27,17 @@
}

function suspend() {
- var suspend = "qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend 1";
+ var suspend = "qdbus --system org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend";
this.execute(suspend);
}

function hibernate() {
- var hibernate = "qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate";
+ var hibernate = "qdbus --system org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Hibernate";
this.execute(hibernate);
}

function shutdown() {
- var shutdown = "qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown";
+ var shutdown = "qdbus --system org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop";
this.execute(shutdown);
}


check to have consolekit and upower installed in order for this to work (this should be default in all "modern" distros)

cheers

Report

pamputt

8 years ago

Do you plan to translate your script?

Report

C

tmske

8 years ago

I have no idea how to do translations for a script, but I can take a look at it if you like. What translations do you want?

Report

pamputt

8 years ago

I am French, so I would like use this script in french. If you want, I can send you translation of your script by email.

Report

C

tmske

8 years ago

Ok, I'll try to take a look at translations, but it probably won't be this week because I'm very busy at the moment. You can find my email on the homepage of sleepy.

Report

martosurf

7 years ago

Tell us when you're ready to add translations and I'll submit one for Español de Argentina (Castellano)

Report

C

tmske

7 years ago

Added french translation, if you want, add some other translations and mail them to me.

Report

martosurf

7 years ago

Sure, but I need a template...

Report

C

tmske

7 years ago

You can find a template here: http://gitorious.org/sleepy/sleepy/trees/master/translations

Report

ilpianista

8 years ago

Hi, nice script but can you add "Amarok Stop" or "Amarok Pause" to triggers? :)
thanks

Report

ilpianista

8 years ago

Done ^^

--- sleepy/action.js~ 2009-10-18 14:09:24.000000000 +0200
+++ sleepy/action.js 2009-10-21 02:21:18.214389001 +0200
@@ -58,6 +58,7 @@
this.suspend = suspend;
this.hibernate = hibernate;
this.shutdown = shutdown;
+ this.stop = stop;
this.execute = execute;
}

@@ -76,6 +77,11 @@
this.execute(shutdown);
}

+function stop(p) {
+ var stop = "Amarok.Engine.Stop(true)";
+ this.execute(stop);
+}
+
function execute(p) {
//print("execute:::");
//print(p);
--- sleepy/gui.js~ 2009-10-18 14:06:54.000000000 +0200
+++ sleepy/gui.js 2009-10-21 02:23:58.954369985 +0200
@@ -80,7 +80,11 @@
if (this.dialog.actionBox.action.currentIndex == 1) {
a = function() {x.action.hibernate();};
} else {
- a = function() {x.action.shutdown();};
+ if (this.dialog.actionBox.action.currentIndex == 2) {
+ a = function() {x.action.shutdown();};
+ } else {
+ a = function() {x.action.stop();};
+ }
}
}
this.track.setAction(a);
--- sleepy/gui.ui~ 2009-10-18 14:06:12.000000000 +0200
+++ sleepy/gui.ui 2009-10-21 02:16:29.954417689 +0200
@@ -215,6 +215,11 @@
<string>Shutdown</string>
</property>
</item>
+ <item>
+ <property name="text">
+ <string>Amarok Stop</string>
+ </property>
+ </item>
</widget>
</widget>
<widget class="QLabel" name="infoDisabled">

Report

C

tmske

8 years ago

Thanks for the patch, I applied it with some minor changes.
I also added custom messages for each action.
If you have other requests you can always ask them and I'll see what I can do.

Report

ilpianista

8 years ago

Thanks!

Report

8 years ago

0.9.3
Added dutch and czech translations
0.9.2
Made translations possible and added french translation
0.9.1
Fixed some typos (thanks bashlnx!)
0.9
- Use Hal now to suspend, hibernate and shutdown. This means (hopefully) that sleepy also works for users who don't have a full kde installation.
- Added the option to quit Amarok.
- There are 2 categories of actions now: General and Amarok actions, both can be set independly.
0.8.2
fixed the pause function before shutting down.
0.8.1
fixed a bug in turn the screen off.
0.8
added the option to turn off the screen.
0.7.1
support for stopping amarok
custom messages for each action
0.7
support for shutdown
0.6
support for suspend and hibernate
triggers are: time based, songs played, play stopped.

product-maker KNCH Jun 21 2011

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
0.9.3
updated Aug 23 2010
added Oct 18 2009
downloads today
0
page views today 0