-
-
Save Gen2ly/2843630 to your computer and use it in GitHub Desktop.
Power management as a regular user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Power management as a regular user | |
case $1 in | |
shutdown | S ) | |
echo " Shutting Down..." | |
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \ | |
/org/freedesktop/ConsoleKit/Manager \ | |
org.freedesktop.ConsoleKit.Manager.Stop > /dev/null ;; | |
restart | R ) | |
echo " Restarting System..." | |
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" \ | |
/org/freedesktop/ConsoleKit/Manager \ | |
org.freedesktop.ConsoleKit.Manager.Restart > /dev/null ;; | |
suspend | s ) | |
echo " Suspending to RAM..." | |
dbus-send --system --print-reply --dest="org.freedesktop.UPower" \ | |
/org/freedesktop/UPower org.freedesktop.UPower.Suspend > /dev/null ;; | |
hibernate | h ) | |
echo " Suspending to Disk..." | |
dbus-send --system --print-reply --dest="org.freedesktop.UPower" \ | |
/org/freedesktop/UPower org.freedesktop.UPower.Hibernate > /dev/null ;; | |
blankmon | b ) | |
echo " Sleeping Monitor..." | |
sleep 1 && xset s activate ;; | |
* ) | |
echo " ${0##*/} <shutdown(S)|restart(R)|suspend(s)|hibernate(h)|blank(b)>" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment