scwrypts v3 refactor

This commit is contained in:
2023-06-27 16:53:59 -06:00
parent 02ed7d615a
commit 1a64551465
57 changed files with 590 additions and 501 deletions

46
scwrypts/desktop/pulseaudio Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/zsh
source $HOME/.config/wryn/env.zsh
DEPENDENCIES+=(
pactl
)
REQUIRED_ENV+=()
use desktop/notify --group dotwryn
use media/audio --group dotwryn
#####################################################################
DEVICE="$1"
COMMAND="$2"
case $DEVICE in
sink ) AMIXER_DEVICE=Master ;;
source ) AMIXER_DEVICE=Capture ;;
* ) NOTIFY_FAIL 1 "Unsupported device '$DEVICE'" ;;
esac
DEFAULT_DEVICE="@DEFAULT_$(echo $DEVICE | tr '[:lower:]' '[:upper:]')@"
case $COMMAND in
up )
pactl set-$DEVICE-volume $DEFAULT_DEVICE +10% \
|| NOTIFY_ERROR "pactl error with set-$DEVICE-volume"
MEDIA__PLAY_SFX volume
;;
down )
pactl set-$DEVICE-volume $DEFAULT_DEVICE -10% \
|| NOTIFY_ERROR "pactl error with set-$DEVICE-volume"
MEDIA__PLAY_SFX volume
;;
mute )
pactl set-$DEVICE-mute $DEFAULT_DEVICE toggle \
&& NOTIFY_SUCCESS "default $DEVICE" "$(amixer sget $AMIXER_DEVICE | grep -q '\[on\]' && echo unmuted || echo muted)" \
|| NOTIFY_ERROR "pactl error with set-$DEVICE-mute"
MEDIA__PLAY_SFX mute
;;
* ) NOTIFY_FAIL 1 "Unsupported command '$COMMAND'" ;;
esac