-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfluxboxexit
56 lines (54 loc) · 1.89 KB
/
fluxboxexit
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
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
case "$1" in
logout)
if [ $DESKTOP_SESSION = "fluxbox" ]; then
killall fluxbox
elif [ $DESKTOP_SESSION = "openbox" ]; then
openbox --exit
elif [ $DESKTOP_SESSION = "i3" ]; then
i3-msg exit
elif [ $DESKTOP_SESSION = "bspwm" ]; then
bspc quit 1
else
pkill -KILL -u $USER
fi
;;
suspend)
if [ $(cat /proc/1/comm) = "systemd" ]; then
systemctl suspend
else
dbus-send --system --dest=org.freedesktop.ConsoleKit --type=method_call --print-reply --reply-timeout=2000 /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Suspend boolean:true
fi
;;
hibernate)
if [ $(cat /proc/1/comm) = "systemd" ]; then
systemctl hibernate
else
dbus-send --system --dest=org.freedesktop.ConsoleKit --type=method_call --print-reply --reply-timeout=2000 /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Hibernate boolean:true
fi
;;
reboot)
if [ $(cat /proc/1/comm) = "systemd" ]; then
systemctl reboot
else
dbus-send --system --print-reply --type=method_call --reply-timeout=2000 --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
fi
;;
shutdown)
if [ $(cat /proc/1/comm) = "systemd" ]; then
systemctl poweroff
else
dbus-send --system --print-reply --type=method_call --reply-timeout=2000 --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
fi
;;
esac
exit 0