diff --git a/.bin/volume_subscribe.sh b/.bin/volume_subscribe.sh new file mode 100755 index 0000000..568ed97 --- /dev/null +++ b/.bin/volume_subscribe.sh @@ -0,0 +1,10 @@ +#!/bin/bash +OLD_VOL=0 +pactl subscribe | grep --line-buffered "sink" | +while read; do + VOL=$(amixer get Master | grep -Po "[0-9]+(?=%)" | tail -1) + if [[ $VOL != $OLD_VOL ]]; then + tvolnoti-show $VOL + OLD_VOL=$VOL + fi +done diff --git a/.config/sway/config b/.config/sway/config index 78a5f8c..8a52365 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -54,7 +54,7 @@ exec mako --default-timeout 10000 exec tvolnoti -n -T dark # Monitor volume changes -exec pactl subscribe | grep --line-buffered "sink" | xargs -n1 sh -c 'tvolnoti-show $(amixer get Master | grep -Po "[0-9]+(?=%)" | tail -1)' +exec ~/.bin/volume_subscribe.sh # Register a fake player in bluez so that volume control would work exec ~/.bin/fakebluezplayer.py