aboutsummaryrefslogtreecommitdiff
path: root/SystemdGraphicalSession/pwrdialog
blob: 4507e1a6dd9178bcdc624e0d0f63ad82e0041032 (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
#!/bin/sh
set -e
choice=$(dialog \
	--clear \
	--erase-on-exit \
	--stdout \
	--backtitle $(hostname) \
	--title "Power Options" \
	--menu "Select an option:" 24 50 12 \
		l "Lock" \
		e "Logout" \
		s "S3" \
		r "Reboot" \
		h "S5")
case $choice in
	l)
		cmd="exec systemctl --user start i3lock"
		;;
	e)
		cmd="exec systemctl --user stop graphical-session.target"
		;;
	s)
		cmd="systemctl --user start i3lock && exec systemctl suspend"
		;;
	r)
		cmd="exec systemctl reboot"
		;;
	h)
		cmd="exec systemctl poweroff"
		;;
	*)
		cmd="exit 1"
		;;
esac
$cmd