soundboard: make things more organised

This commit is contained in:
dogeystamp 2022-10-07 19:42:19 -04:00
parent 1f1c4439c0
commit e78cd1abd9
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
5 changed files with 33 additions and 11 deletions

View File

@ -12,6 +12,7 @@ gpgt
# Add .local/bin to path
set -gx PATH "$PATH:$HOME/.local/bin:"
set -gx PATH "$PATH:$HOME/.local/bin/deskutils:"
set -gx PATH "$PATH:$HOME/.local/bin/deskutils/soundboard:"
set -gx PATH "$PATH:$HOME/.local/bin/minrss-scripts:"
# Disable fish greeting

View File

@ -1,22 +1,29 @@
# Soundboard setup
# "Boxes" labelled 0-9 in ~/med/sb2/
# "Boxes" labelled 0-9 in $SB_DIR/
# Each one has files/symlinks 0-9
# change dir
super + {0-9}
unlink ~/med/sb/cur;\
ln -sr ~/med/sb/{0-9} ~/med/sb/cur;\
rm /tmp/sb-socket*
unlink $SB_DIR/cur;\
ln -sr $SB_DIR/{0-9} $SB_DIR/cur
# start sound
KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
id=$(cat /dev/random | base32 | head -c 5);\
socket="/tmp/sb-socket$snd_id-$id";\
mpv --input-ipc-server=$socket ~/med/sb/cur/$snd_id*;\
rm $socket
socket="$SB_DIR/cur/sb-socket$snd_id-$id";\
mpv --input-ipc-server=$socket $SB_DIR/cur/$snd_id*;\
rm -f "$socket"
# stop specific sound
shift + KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
ls /tmp/sb-socket$snd_id-* |\
while read -r socket; do \
echo {"stop"} | socat - $socket;\
done
ls $SB_DIR/cur/sb-socket$snd_id-* | sb-msg "stop"
# stop all sounds in current dir
KP_Delete
ls $SB_DIR/cur/sb-socket* | stop.sh
# stop all sounds
shift + KP_Delete
find $SB_DIR/ -name "sb-socket*" | sb-msg "stop"

View File

@ -2,6 +2,10 @@
# Dunst notification sound script.
if [ $DUNST_URGENCY = "LOW" ]; then
exit
fi
if pactl list short sinks | grep -q virtual_mic; then
mpv ~/.local/bin/deskutils/notif.wav --audio-device=pulse/c1_out
else

View File

@ -0,0 +1,7 @@
#!/bin/sh
# Given a list of mpv sockets through stdin, send a message to all of them
while read -r socket; do
printf "$1\n" | socat - $socket
rm "$socket"
done

View File

@ -4,6 +4,7 @@
export XDG_CONFIG_HOME="$HOME"/.config
export XDG_CACHE_HOME="$HOME"/.cache
export XDG_DATA_HOME="$HOME"/.local/share
export XDG_DOWNLOAD_DIR="$HOME"/quar/
# Clean up home directory dotfiles
@ -35,6 +36,8 @@ export BROWSER="qutebrowser"
export MANPAGER='nvim +Man!'
export MANWIDTH=999
# Soundboard
export SB_DIR="$HOME"/med/sb
export SXHKD_SHELL='/bin/sh'
# Variables for passphrase2pgp