From 744713424274edb50a1f9baed69dfe7f503b74bf Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Thu, 16 Apr 2020 15:55:35 +0300 Subject: [PATCH] Filter volume changes --- .bin/volume_subscribe.sh | 10 ++++++++++ .config/sway/config | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 .bin/volume_subscribe.sh 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