Sweet! I found that a while ago when I ran Openbox on Arch. I also made zenity scripts that I bound
to my keys.
WARNING: The lines between then and else that start with dbus-send
must be in 1 line. The browser will probably
break the lines depending on your browser window size.
Shutdown:
- Code: Select all
#!/bin/bash
zenity --question --text="Shutdown?"
if [ $? == 0 ]
then
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
else
exit
fi
Reboot:
- Code: Select all
#!/bin/bash
zenity --question --text="Restart?"
if [ $? == 0 ]
then
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
else
exit
fi
Suspend:
- Code: Select all
#!/bin/bash
zenity --question --text="Suspend?"
if [ $? == 0 ]
then
dbus-send --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0
else
exit
fi
Hibernate:
- Code: Select all
#!/bin/bash
zenity --question --text="Hibernate?"
if [ $? == 0 ]
then
dbus-send --system --print-reply --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate
else
exit
fi
You will need the package
zenity for this.
I am not sure anymore whether suspend and hibernate need HAL, but I'd guess they do, since they hint to it in the commands.
Someone please correct me if it's wrong.