sleepy (shutdown script)

Amarok 2.x Scripts

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

1
Become a Fan
5.7

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:

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.


Ratings & Comments

17 Comments

evilblade

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

poomerang

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!

poomerang

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

poomerang

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

poomerang

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

pamputt

Do you plan to translate your script?

tmske

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?

pamputt

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.

tmske

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.

martosurf

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

tmske

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

martosurf

Sure, but I need a template...

tmske

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

ilpianista

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

ilpianista

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">

tmske

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.

ilpianista

Thanks!

Pling
0 Affiliates
Details
license
version 0.9.3
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 4

More Amarok 2.x Scripts from tmske:

AlbumFilter
tmske
last update date: 15 years ago

Score 5.7

Other Amarok 2.x Scripts:

raya
raya1234
last update date: 15 years ago

Score 5.0

Partition Assistant
shiny521
last update date: 15 years ago

Score 5.0

google-clone
jenifferhomes
last update date: 15 years ago

Score 5.6

Quran Audio Library
boubakr92
last update date: 12 years ago

Score 4.4

Remove Current Track
alexoleshkevich
last update date: 14 years ago

Score 4.7

indoLyrics
cyrus007
last update date: 14 years ago

Score 4.7



System Tags