Commit: e9307a771a3e181a5d61f1ddfcb2a2815bc0091e Parent: 654f7614421d09d0a40698b642183facf971d982 Author: Randy Palamar Date: Mon, 12 Apr 2021 14:24:00 -0600 add sysact script and improve confirm Diffstat:
| M | bin/confirm | | | 5 | ++++- |
| A | bin/sysact | | | 18 | ++++++++++++++++++ |
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/bin/confirm b/bin/confirm @@ -2,4 +2,7 @@ # confirms an action with dmenu before executing -[ "$(printf "no\\nyes" | dmenu -i -p "$1")" = "yes" ] && $2 +prompt=$1 +shift + +[ "$(printf "no\nyes" | dmenu -i -p "$prompt")" = "yes" ] && $@ diff --git a/bin/sysact b/bin/sysact @@ -0,0 +1,18 @@ +#!/bin/sh + +# use dmenu to select and perform a system action + +SUCMD=doas + +options="\ +lock +suspend +reboot +shutdown" + +case $(echo "$options" | dmenu -i -p "Action:") in +lock) slock ;; +suspend) $SUCMD /sbin/zzz ;; +reboot) $SUCMD /sbin/shutdown -r now ;; +shutdown) $SUCMD /sbin/shutdown -h now ;; +esac