commit 399b1a8e962127276b0665939e4c4b3552027aab
parent c61ab30d879c22e97f394418cb491e93c73a22a9
Author: pyratebeard <root@pyratebeard.net>
Date: Mon, 20 May 2024 16:49:54 +0100
move dmenu wrapper out of dotfiles
Diffstat:
A | bin/.local/bin/rundmc | | | 91 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 91 insertions(+), 0 deletions(-)
diff --git a/bin/.local/bin/rundmc b/bin/.local/bin/rundmc
@@ -0,0 +1,91 @@
+#!/usr/bin/zsh
+# ██
+# ░██
+# ██████ ██ ██ ███████ ░██ ██████████ █████
+# ░░██░░█░██ ░██░░██░░░██ ██████░░██░░██░░██ ██░░░██
+# ░██ ░ ░██ ░██ ░██ ░██ ██░░░██ ░██ ░██ ░██░██ ░░
+# ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ ░██ ░██░██ ██
+# ░███ ░░██████ ███ ░██░░██████ ███ ░██ ░██░░█████
+# ░░░ ░░░░░░ ░░░ ░░ ░░░░░░ ░░░ ░░ ░░ ░░░░░
+#
+# author ▓▒ pyratebeard <root@pyratebeard.net>
+# code ▓▒ https://git.pyratebeard.net/scripts
+
+ln=10
+nb="#181512"
+nf="#d3cab3"
+sb="#2b2f2e"
+sf="#a4b810"
+fn="gohu:size=11"
+RICE="-i -m 0 -l $ln -nb $nb -nf $nf -sb $sb -sf $sf -fn $fn"
+
+wat(){
+ /usr/bin/notify-send -u low '❓ what ❓'
+}
+
+select_arr=("run" "mus" "man" "pom" "vid" "clip" "emoji" "display")
+submenu=$(printf '%s\n' "${select_arr[@]}" | dmenu $=RICE -p '▎▍▌▋▊')
+
+case $submenu in
+ run)
+ dmenu_run $=RICE -p 'run'
+ ;;
+ mus)
+ music=$(echo -e "cmus\nncmpcpp" | dmenu $=RICE -p "select your player")
+ case $music in
+ cmus) urxvtc -e dtach -A /tmp/mus cmus ;;
+ ncmpcpp) pidof mpd >/dev/null || \
+ mpd $XDG_CONFIG_HOME/mpd/mpd.conf ; \
+ LANG=en_US.UTF-8 urxvtc -e ncmpcpp ;;
+ *) wat ;;
+ esac ;;
+ man)
+ man_arr=()
+ while IFS= read -r line; do
+ man_arr+=( "$line" )
+ done < <(man -k .)
+
+ choice=$(printf '%s\n' "${man_arr[@]}" | dmenu $=RICE -p 'man')
+
+ if [ "$choice" ] ; then
+ cmd=$(printf '%s\n' "${man_arr[@]}" | grep ^$choice | awk '{print $1"."$2}' | tr -d '()')
+ herbstclient layout | grep horizontal && \
+ herbstclient chain , split bottom 0.5 , focus down || \
+ herbstclient chain , split right 0.5 , focus right
+ urxvt -e zsh -c "source $HOME/.zsh/colored-man-pages.zsh ; man ${cmd}"
+ herbstclient remove
+ fi ;;
+ pom)
+ sleep 1500 && /usr/bin/notify-send -u "low" "time's up"
+ ;;
+ vid)
+ feed="${2:-$(true | dmenu $=RICE -p '{url,path}')}"
+ setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
+ clip)
+ clipmenu $=RICE -p 'clipboard'
+ ;;
+ emoji)
+ emote=$(cut -d ';' -f1 ~/.local/share/emotes/* | dmenu $=RICE -p "how do you feel?")
+ echo -n "$emote" | xsel -i ;;
+ display)
+ display=$(echo -e "lair\nwork" | dmenu $=RICE -p "where am i?")
+ case $display in
+ lair) xrandr --output HDMI-2 \
+ --mode 1920x1080 \
+ --pos 1920x0 \
+ --rotate normal \
+ --output DVI-D-1 \
+ --primary \
+ --mode 1920x1080 \
+ --rotate normal ; herbstclient reload ;;
+ work) xrandr --output HDMI-2 \
+ --primary \
+ --mode 1920x1080 \
+ --pos 1920x0 \
+ --rotate normal \
+ --output DVI-D-1 \
+ --off ; herbstclient reload ;;
+ *) wat ;;
+ esac ;;
+ *) exit ;;
+esac