aboutsummaryrefslogtreecommitdiff
path: root/dmenu-dwm-sessionmanager
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-06-10 18:58:52 +0200
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-06-10 18:58:52 +0200
commitb98e05ba63f2e108df634b4d9f9e5530769c6b80 (patch)
treea1d3a7f20e826d264f2a6b2141b7b1bfa7debb6f /dmenu-dwm-sessionmanager
parented61c5f085cebb86d3d3a34ce01ec22069c1fc70 (diff)
downloadscripts-b98e05ba63f2e108df634b4d9f9e5530769c6b80.tar.gz
scripts-b98e05ba63f2e108df634b4d9f9e5530769c6b80.zip
Added scripts and readme
Diffstat (limited to 'dmenu-dwm-sessionmanager')
-rwxr-xr-xdmenu-dwm-sessionmanager24
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
6menu=${MENU:-dmenu}
7menuopts="-i -p"
8menuprompt="Do you want to quit?"
9wmname="dwm"
10
11shutdown_cmd="sudo shutdown -h now"
12reboot_cmd="sudo reboot"
13closewm_cmd="pkill $wmname"
14
15value=$(echo "Shutdown\nReboot\nQuit dwm" | $menu $menuopts "$menuprompt")
16
17if [ "$value" = "Shutdown" ]; then
18 $shutdown_cmd
19elif [ "$value" = "Reboot" ]; then
20 $reboot_cmd
21elif [ "$value" = "Quit $wmname" ]; then
22 $closewm_cmd
23fi
24

Generated with cgit - Back to sebastiano.tronto.net