aboutsummaryrefslogtreecommitdiff
path: root/i3/bin/suspend-menu
blob: 46342ec9cb94406b754aa045917b943a16bb91c7 (plain) (blame)
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
#!/bin/bash

print_options () {
	cat <<EOF
suspend
reboot
shutdown
reload i3 configuration in-place
restart i3
exit i3
EOF
}

# Colors from i3-nagbar: https://github.com/i3/i3/blob/a5da4d54f315e830e2a901b8e75ae7e478401c6e/i3-nagbar/main.c#L492-L496
CHOICE="$(print_options | dmenu -i -fn 'DejaVu Sans' -nb '#900000' -nf white -sb '#680a0a' -sf white)"

case "$CHOICE" in
	suspend) sleep 5; systemctl suspend-then-hibernate ;;
	reboot) systemctl reboot ;;
	shutdown) shutdown now ;;
	"reload i3 configuration in-place") i3-msg reload ;;
	"restart i3") i3-msg restart ;;
	"exit i3") i3-msg exit ;;
	*)
		exit 1
		;;
esac