Description: Amarok script for suspend, hibernate, shutdown KDE4 and pausing, stopping or closing Amarok according to playlist settings or elapsed time. This script is based on the "Sleepy" script 0.9.3 by Thomas Coopman (http://kde-apps.org/content/show.php/sleepy+%28shutdown+script%29?content=113946). It was edited for usage on KDE4 with qdbus (without HAL). The GUI was slightly reworked (see the screenshot). Besides the translations were removed.
You're welcome!
Well, I haven't done it because it was only changed for using without HAL, that isn't a real need for everyone who uses the script. And the GUI was changed (just a little bit though), that also wouldn't be useful for everyone.
Here is the patch for "action.js" for using the script without HAL:
Quote:
--- sleepy/action.js 2011-06-21 16:55:44.711041919 +0200
+++ sleepyKNCH/action.js 2011-06-21 03:58:55.242503560 +0200
@@ -12,6 +12,8 @@
//
//You should have received a copy of the GNU General Public License
//along with Amarok. If not, see <http://www.gnu.org/licenses/>.
+//
+// edited by KNCH
Importer.loadQtBinding( "qt.core" );
@@ -22,22 +24,22 @@
this.execute = execute;
this.pause = pause;
this.stop = stop;
- this.quit = quit;
- this.turnOffScreen = turnOffScreen;
+ this.quit = quit;
+ this.turnOffScreen = turnOffScreen;
}
function suspend() {
- var suspend = "qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend 1";
+ var suspend = "qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.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 org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.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 org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout 1 2 2";
this.execute(shutdown);
}
Ratings & Comments
2 Comments
Thanks! ...but why you didn't submit your patches to the original sleepy?
You're welcome! Well, I haven't done it because it was only changed for using without HAL, that isn't a real need for everyone who uses the script. And the GUI was changed (just a little bit though), that also wouldn't be useful for everyone. Here is the patch for "action.js" for using the script without HAL: Quote:
--- sleepy/action.js 2011-06-21 16:55:44.711041919 +0200
+++ sleepyKNCH/action.js 2011-06-21 03:58:55.242503560 +0200
@@ -12,6 +12,8 @@
//
//You should have received a copy of the GNU General Public License
//along with Amarok. If not, see <http://www.gnu.org/licenses/>.
+//
+// edited by KNCH
Importer.loadQtBinding( "qt.core" );
@@ -22,22 +24,22 @@
this.execute = execute;
this.pause = pause;
this.stop = stop;
- this.quit = quit;
- this.turnOffScreen = turnOffScreen;
+ this.quit = quit;
+ this.turnOffScreen = turnOffScreen;
}
function suspend() {
- var suspend = "qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend 1";
+ var suspend = "qdbus org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.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 org.freedesktop.PowerManagement /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.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 org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.logout 1 2 2";
this.execute(shutdown);
}