commit be366dae1f51b21cfd1a19b0dd9e262abd258db7
parent 6b44426288aac14961c56c84ca4f44183f1200ba
Author: Matthew Carlson <matt@mcarlson.xyz>
Date: Thu, 29 Jul 2021 01:50:58 -0400
added sys menu script
Diffstat:
4 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/.config/ytfzf/ytfzf.sh b/.config/ytfzf/ytfzf.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# ytfzf.sh
+# ytfzf
# env vars
YTFZF_CUR=1
diff --git a/.local/bin/lock.sh b/.local/bin/lock.sh
@@ -9,7 +9,7 @@ for socket in "${SOCKETS_DIR}"/*; do
printf 'set pause yes' | socat - "${socket}";
done
-bpid=$(ps -ef | grep "\<${BROWSER}\>" | awk '{ printf "%s ", $2 }')
+bpid=$(ps -ef | grep "\<${BROWSER}\>" | grep -v '\<grep\>' | awk '{ printf "%s ", $2 }')
[ -n "${bpid}" ] && kill -STOP ${bpid}
diff --git a/.local/bin/sys.sh b/.local/bin/sys.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# sys
+
+CMDS="\
+ Lock lock.sh
+ Shutdown doas shutdown -h now
+ Restart doas shutdown -r now
+"
+
+lines=$(printf '%s' "${CMDS}" | grep -c '^')
+
+choice="$(printf '%s' "${CMDS}" | cut -d ' ' -f 1-2 | dmenu -c -i -l "${lines}")" || exit 1
+
+cmd="$(printf '%s\n' "${CMDS}" | grep "^${choice}[\s]*" | awk '{ $1=""; $2=""; print }' | sed 's/^[[:space:]]*//g')"
+
+${cmd}
diff --git a/.local/bin/wp.sh b/.local/bin/wp.sh
@@ -114,7 +114,7 @@ theme() {
xrdb "${XRESOURCES}"
# reload all instances of term
- kill -s USR1 $(ps -ef | grep "\<${TERMINAL}\>" | grep -v "\<grep\>" | awk '{ printf "%s ", $2 }')
+ kill -s USR1 $(ps -ef | grep "\<${TERMINAL}\>" | grep -v '\<grep\>' | awk '{ printf "%s ", $2 }')
# hacky work-around to change terminal fg on the fly
# buggy with alpha