soundboard: add indicator listing directory contents

This commit is contained in:
dogeystamp 2022-10-08 13:48:40 -04:00
parent a17b721bbb
commit c34c81bde7
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
3 changed files with 34 additions and 6 deletions

View File

@ -3,7 +3,7 @@
# Directory tree under $SB_DIR
# Play sounds in current dir using numpad 0-9 keys
# Navigate to a dir under current one with super + 0-9
# Navigate back to root with super + minus
# Navigate back to root with super + `
# change dir
@ -13,18 +13,27 @@ super + {0-9}
fi;\
ln -sr $SB_DIR/$(readlink $SB_DIR/cur)/{0-9}* $SB_DIR/cur_n;\
unlink $SB_DIR/cur;\
mv $SB_DIR/cur_n $SB_DIR/cur
mv $SB_DIR/cur_n $SB_DIR/cur;\
sb-ls.sh
# set current directory to $SB_DIR
super + minus
super + grave
unlink $SB_DIR/cur;\
ln -sr $SB_DIR $SB_DIR/cur
ln -sr $SB_DIR $SB_DIR/cur;\
sb-ls.sh
# list current directory contents
KP_Enter
sb-ls.sh
# super + shift + `
super + asciitilde
sb-ls.sh
# start sound
KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
if [ -z "$SB_DIR" ]; then \
notify-send -u critical -a "soundboard" '$SB_DIR is unset!';\
exit;\
exit 1;\
fi;\
snd_id="{0-9}";\
id=$(cat /dev/random | base32 | head -c 5);\

View File

@ -2,7 +2,7 @@
# Dunst notification sound script.
if [ $DUNST_URGENCY = "LOW" ]; then
if [ "$DUNST_APP_NAME" = "soundboard" ]; then
exit
fi

View File

@ -0,0 +1,19 @@
#!/bin/sh
# List current soundboard directory as a notification.
if [ -z "$SB_DIR" ]; then
notify-send -u critical -a "soundboard" '$SB_DIR is unset!'
exit 1
fi
CUR_DIR="$SB_DIR"/"$(readlink $SB_DIR/cur)"
list () {
find "$CUR_DIR" -mindepth 1 -maxdepth 1 \( -type l -o -type d -o -type f \) -print0 |\
xargs -0 -i{} basename {} | sort
}
notify-send \
-a "soundboard" \
-r 13371337 \
"$(printf "$(basename "$CUR_DIR")\n$(list)")"