aboutsummaryrefslogtreecommitdiffstats
path: root/_i3/scripts/i3exit.sh
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@gmail.com>2016-01-06 22:59:26 +0800
committerAaron LI <aaronly.me@gmail.com>2016-01-06 22:59:26 +0800
commit25b947edf445a96db335fe285a8b253b214649ff (patch)
tree3f785cdbef303c71111debd067c95a62ea456587 /_i3/scripts/i3exit.sh
parent0ed3373f1c2d47aba769aa67439e05350c2792e9 (diff)
downloaddotfiles-25b947edf445a96db335fe285a8b253b214649ff.tar.bz2
Rename .* => _*; Move out private contents.
Diffstat (limited to '_i3/scripts/i3exit.sh')
-rwxr-xr-x_i3/scripts/i3exit.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/_i3/scripts/i3exit.sh b/_i3/scripts/i3exit.sh
new file mode 100755
index 0000000..3616139
--- /dev/null
+++ b/_i3/scripts/i3exit.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# exit script used in i3 wm
+#
+
+PNG_IMAGE="~/.i3/images/wallpaper.png"
+
+lock() {
+ if [ -f ${PNG_IMAGE} ]; then
+ i3lock -d -ti "${PNG_IMAGE}"
+ else
+ i3lock -d -c 000000
+ fi
+}
+
+case "$1" in
+ lock)
+ lock
+ ;;
+ logout)
+ i3-msg exit
+ ;;
+ suspend)
+ lock
+ dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
+ ;;
+ hibernate)
+ lock
+ dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
+ ;;
+ reboot)
+ dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
+ ;;
+ shutdown)
+ dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
+ ;;
+ *)
+ echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
+ exit 2
+esac
+
+exit 0
+