feat: bash

This commit is contained in:
ange 2024-06-23 11:51:38 +02:00
parent 937ab54f8c
commit 7ae0b331cf
Signed by: ange
GPG key ID: 9E0C4157BB7BEB1D
30 changed files with 517 additions and 65 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash -e
SINK='@DEFAULT_AUDIO_SINK@'
NOTIFY=(notify-send -t 1000 -a "$(basename "$0")" -u low)
NOTIFY=(notify-send -t 1000 -u low)
function update_vol() {
if [[ "$1" =~ ^(-|\+)* ]]; then
@ -22,14 +22,13 @@ if [ -z "$1" ]; then
exit
elif [ "$1" == 'm' ] && [ -z "$MUTE" ]; then
wpctl set-mute "$SINK" 1
"${NOTIFY[@]}" -i audio-volume-muted -h string:synchronous:vol "Mute"
"${NOTIFY[@]}" -i audio-volume-muted-symbolic -h string:synchronous:vol "Mute"
else
if [[ "$1" =~ [0-9] ]]; then
update_vol "$1"
fi
[ -n "$MUTE" ] && wpctl set-mute "$SINK" 0
"${NOTIFY[@]}" -h string:synchronous:vol -h int:value:"$CUR" "$CUR%"
"${NOTIFY[@]}" -i audio-volume-high-symbolic -h string:synchronous:vol -h int:value:"$CUR" "$CUR%"
fi
# update sbar
kill -34 "$(cat "$HOME/.cache/pidofbar")"
kill -35 "$(cat "$HOME/.cache/pidofbar")"