summaryrefslogtreecommitdiff
path: root/keyboard/dmenunametag
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2021-10-20 15:10:12 -0500
committerTimmy Keller <tjk@tjkeller.xyz>2021-10-20 15:10:12 -0500
commitd69d9b248be9abeff886815cf5edd46de8b8f50e (patch)
treec47f398fe61c78cc636988838d7bb0b3b760b280 /keyboard/dmenunametag
parente7786d9b1904ecd2c9989c3f157df48016b0dd50 (diff)
downloadscripts-d69d9b248be9abeff886815cf5edd46de8b8f50e.tar.xz
scripts-d69d9b248be9abeff886815cf5edd46de8b8f50e.zip
dmenunametag script
Diffstat (limited to 'keyboard/dmenunametag')
-rwxr-xr-xkeyboard/dmenunametag19
1 files changed, 19 insertions, 0 deletions
diff --git a/keyboard/dmenunametag b/keyboard/dmenunametag
new file mode 100755
index 0000000..b4ea69e
--- /dev/null
+++ b/keyboard/dmenunametag
@@ -0,0 +1,19 @@
+#!/bin/sh
+numtags=9
+while !([ $tagnum -ge 1 2>/dev/null ] && [ $tagnum -le $numtags ]); do
+ tagnum=$(seq $numtags | dmenu -p "Choose tag: ")
+ [ "$tagnum" = "" ] && exit
+done
+while [ "$action" != "Rename" ] && [ "$action" != "Remove" ]; do
+ action=$(echo -n "Rename\nRemove" | dmenu -p "Would you like to rename or remove this tag $tagnum's label? ")
+ [ "$action" = "" ] && exit
+done
+if [ "$action" = "Rename" ]; then
+ name="$(dmenu -p "Rename tag $tagnum to: " <&-)"
+ [ "$name" = "" ] && exit
+ nametag $tagnum n "$name"
+else
+ nametag $tagnum r
+fi
+# Force bar to update by setting the root name to itself since there is currently a bug in the window manager
+xsetroot -name "$(xprop -root WM_NAME | sed -n 's/^WM_NAME(STRING) = \"\(.*\)\"/\1/p')"