blob: 3616139537d827f76864ae67f0285f7d6caab613 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
|