blob: f423a096008c35eb13d2c0f3cc15091842949b19 (
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
|
#!/bin/sh
# Prompts menu to shutdown/reboot/close dwm
# Usage: dmenu-dwm-sessionmanager [-m menu]
# Requires: dmenu (or equivalent), dwm (optional)
menu="dmenu -i"
prompt="Do you want to quit?"
while getopts "m:" opt; do
case "$opt" in
m)
menu="$OPTARG"
;;
esac
done
shift `expr $OPTIND - 1`
wmname="dwm"
shutdown_cmd="sudo shutdown -h now"
reboot_cmd="sudo reboot"
closewm_cmd="pkill $wmname"
value=$(echo "Shutdown\nReboot\nQuit dwm" | $menu -p "$prompt")
if [ "$value" = "Shutdown" ]; then
$shutdown_cmd
elif [ "$value" = "Reboot" ]; then
$reboot_cmd
elif [ "$value" = "Quit $wmname" ]; then
$closewm_cmd
fi
|