diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-06-10 18:58:52 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-06-10 18:58:52 +0200 |
| commit | b98e05ba63f2e108df634b4d9f9e5530769c6b80 (patch) | |
| tree | a1d3a7f20e826d264f2a6b2141b7b1bfa7debb6f /dmenu-dwm-sessionmanager | |
| parent | ed61c5f085cebb86d3d3a34ce01ec22069c1fc70 (diff) | |
| download | scripts-b98e05ba63f2e108df634b4d9f9e5530769c6b80.tar.gz scripts-b98e05ba63f2e108df634b4d9f9e5530769c6b80.zip | |
Added scripts and readme
Diffstat (limited to '')
| -rwxr-xr-x | dmenu-dwm-sessionmanager | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/dmenu-dwm-sessionmanager b/dmenu-dwm-sessionmanager new file mode 100755 index 0000000..74ddcf0 --- /dev/null +++ b/dmenu-dwm-sessionmanager | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Prompts menu to shutdown/reboot/close dwm | ||
| 4 | # Requires: dmenu (or equivalent), dwm (optional) | ||
| 5 | |||
| 6 | menu=${MENU:-dmenu} | ||
| 7 | menuopts="-i -p" | ||
| 8 | menuprompt="Do you want to quit?" | ||
| 9 | wmname="dwm" | ||
| 10 | |||
| 11 | shutdown_cmd="sudo shutdown -h now" | ||
| 12 | reboot_cmd="sudo reboot" | ||
| 13 | closewm_cmd="pkill $wmname" | ||
| 14 | |||
| 15 | value=$(echo "Shutdown\nReboot\nQuit dwm" | $menu $menuopts "$menuprompt") | ||
| 16 | |||
| 17 | if [ "$value" = "Shutdown" ]; then | ||
| 18 | $shutdown_cmd | ||
| 19 | elif [ "$value" = "Reboot" ]; then | ||
| 20 | $reboot_cmd | ||
| 21 | elif [ "$value" = "Quit $wmname" ]; then | ||
| 22 | $closewm_cmd | ||
| 23 | fi | ||
| 24 | |||
