-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathlogout.sh
executable file
·37 lines (33 loc) · 1000 Bytes
/
logout.sh
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
#!/bin/sh
# slock is called via /lib/systemd/system-sleep/10lockscreen.
# TODO: via systemd user file/service?!
# Required when only suspending, e.g. closing lid!
# close stdin
exec <&-
ACTION=$(printf 'suspend|hybrid-sleep|hibernate|reboot|shutdown|switch-user|logout|lock' \
| rofi -width -40 -dmenu -sep '|' -p "How do you want to quit? ")
if [ -n "${ACTION}" ];then
case $ACTION in
switch-user)
# Lightdm: detect via XDG_SEAT_PATH
dm-tool switch-to-greeter
# for gdm: gdmflexiserver --startnew
;;
hybrid-sleep)
/usr/bin/slock &
systemctl hybrid-sleep ;;
suspend)
/usr/bin/slock &
systemctl suspend
;;
hibernate)
systemctl hibernate ;;
reboot)
zenity --question --text "Are you sure?" && systemctl reboot ;;
shutdown)
zenity --question --text "Are you sure?" && systemctl poweroff ;;
logout)
zenity --question --text "Are you sure?" && awesome-logout ;;
lock) slock ;;
esac
fi