Compare commits

...

9 Commits

13 changed files with 159 additions and 14 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

@ -0,0 +1 @@
CTRL+p script-message osc-playlist

View File

@ -1 +1,2 @@
osd-status-msg=${playback-time/full} / ${duration} (${percent-pos}%)\nframe: ${estimated-frame-number} / ${estimated-frame-count}
input-ipc-server="/tmp/mpv-socket"

View File

@ -39,11 +39,12 @@ set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?'
set charset = "utf-8"
mailboxes =Inbox
mailboxes =Archive =Sent =Drafts =Junk =Trash
mailboxes =Archive =Sent =Drafts =Junk =Trash =../arc
set sendmail="/usr/bin/msmtp -a mail"
macro index O "<shell-escape>mbsync -c \"$XDG_CONFIG_HOME\"/isync/mbsyncrc disroot <enter>" "run offlineimap to sync all mail"
macro index,pager A "<save-message>=../arc<enter>" "Archive Message"
bind index,pager \CP sidebar-prev
# Ctrl-P Previous Mailbox
bind index,pager \CN sidebar-next

View File

@ -21,6 +21,7 @@ c.scrolling.smooth = False
c.url.default_page = "about:blank"
c.url.start_pages = "about:blank"
c.url.searchengines = {"DEFAULT":"https://searx.be/search?q={}"}
c.downloads.location.directory = "~/quar/"
# Downloads

View File

@ -1,22 +1,83 @@
# Soundboard setup
# "Boxes" labelled 0-9 in ~/med/sb2/
# Each one has files/symlinks 0-9
# Soundboard
# 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 + `
# change dir
super + {0-9}
unlink ~/med/sb/cur;\
ln -sr ~/med/sb/{0-9} ~/med/sb/cur;\
rm /tmp/sb-socket*
if [ ! -h $SB_DIR/cur ]; then \
ln -sr $SB_DIR $SB_DIR/cur;\
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;\
sb-ls.sh
# set current directory to $SB_DIR
super + grave
unlink $SB_DIR/cur;\
ln -sr $SB_DIR $SB_DIR/cur;\
sb-ls.sh
# list currently playing + volume
KP_Enter
find $SB_DIR/ -name "sb-socket*" | sb-vol
# list current directory contents
# 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 1;\
fi;\
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"
# loop specific sound
ctrl + shift + KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket$snd_id-* | sb-msg "set loop inf"
# reduce volume of current dir
ctrl + shift + KP_Subtract
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket* | sb-msg "add volume -5";\
ls $SB_DIR/cur/sb-socket* | sb-vol
# increase volume of current dir
ctrl + shift + KP_Add
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket* | sb-msg "add volume +5";\
ls $SB_DIR/cur/sb-socket* | sb-vol
# reduce volume of specific sound
ctrl + KP_Subtract; KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket$snd_id-* | sb-msg "add volume -10";\
ls $SB_DIR/cur/sb-socket$snd_id-* | sb-vol
# increase volume of specific sound
ctrl + KP_Add; KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
snd_id="{0-9}";\
ls $SB_DIR/cur/sb-socket$snd_id-* | sb-msg "add volume +10";\
ls $SB_DIR/cur/sb-socket$snd_id-* | sb-vol
# stop all sounds
shift + KP_Delete
find $SB_DIR/ -name "sb-socket*" | sb-msg "stop";\
find $SB_DIR/ -name "sb-socket*" | xargs rm

View File

@ -19,11 +19,14 @@ then
--chown=dogeystamp:sftpr \
--exclude=med/mus \
--exclude=med/gv \
--exclude=sb-socket \
--exclude=med/sb/cur \
--exclude=dox/dow \
--exclude=dox/rss \
--exclude=dox/rem \
--exclude=dox/proj \
--exclude=dox/vms \
--exclude=dox/mail/disroot \
--exclude=med/pix/hdri \
--exclude=med/memes/woof/quar \
--exclude=BL_proxy \

View File

@ -2,6 +2,10 @@
# Dunst notification sound script.
if [ "$DUNST_APP_NAME" = "soundboard" ]; 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,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)")"

View File

@ -0,0 +1,6 @@
#!/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 | grep "{.*"
done

View File

@ -0,0 +1,39 @@
#!/bin/sh
# Get volumes of mpv sockets piped through stdin
SOCKETS=""
while read x; do
SOCKETS=$(printf "%s\n%s" "$SOCKETS" "$x")
done
SOCKETS=$(printf %s "$SOCKETS" | sed "/^$/d")
VOLS=$(echo "$SOCKETS" |\
sb-msg '{ "command": ["get_property", "volume"], "request_id": 1336 }' |\
jq .data | awk '{ printf("%.0f\n", $0) }')
PATHS=$(echo "$SOCKETS" |\
sb-msg '{ "command": ["get_property", "path"], "request_id": 1337 }' |\
jq -r .data)
NAMES=""
for x in $PATHS; do
NAMES="$NAMES $(basename $x)"
done
CNT=$(echo $PATHS | wc -w)
if [ "$CNT" = 0 ]; then
exit
fi
CUR_DIR="$(basename $(readlink $SB_DIR/cur))"
zip () {
awk '{for(i=1; i<=NF/2; i++) {j=NF/2+i; printf "%s %s%\n",$i,$j;}}'
}
PROMPT=$(printf '%s\n%s' "$CUR_DIR" "$(echo "$NAMES" $VOLS | zip | column --table --output-width 20)")
notify-send \
-a "soundboard" \
-r 13371337 \
"$(printf "%s" "$PROMPT")"

5
src/.local/bin/mpvq Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
# Append link from clipboard to mpv playlist
path="$(xsel -b)"
echo "{ command: [ \"loadfile\", \"$path\", \"append-play\" ] }" | socat - /tmp/mpv-socket

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