if [[ "$CurrVolume" != "$LastVolume" ]] ; then
# Ask Ubuntu: https://askubuntu.com/a/871207/307523
notify-send --urgency=critical "tvpowered" \
-h string:x-canonical-private-synchronous:volume \ --icon=/usr/share/icons/gnome/48x48/devices/audio-speakers.png \ "Volume: $CurrVolume" LastVolume=$CurrVolume VolumeCnt=10
# TODO: Process VolumeCnt internally in loop instead of larger loop
fi
if [[ $VolumeCnt > 0 ]]; then
(( VolumeCnt-- )) SleepTime=.01
else SleepTime=2.5
fi
sleep $SleepTime
In the link comments point out how this only works in Ubuntu and not in Gnome. It works fine in Ubuntu 16.04.7 LTS with Unity desktop but I haven't tried it on other desktops yet
SleepTime of '0.01' is too small for real time but the bash script has overhead of communicating to TV over WiFi which gives it about the '0.5' seconds lag.
I ended up using the answer in Ask Ubuntu: https:/ /askubuntu. com/a/871207/ 307523
The basic concept is you link your message to the last message you sent with an extra line:
-h string: x-canonical- private- synchronous: anything
Where 'anything' is the string/text grouping your spamming bubbles together so fast repeating one replaces the one before (in that same group).
Code snippet from within larger while loop:
GetVolume
CurrVolume="$?"
# echo CurrVolume: $CurrVolume LastVolume: $LastVolume
if [[ "$CurrVolume" != "$LastVolume" ]] ; then /askubuntu. com/a/871207/ 307523 x-canonical- private- synchronous: volume \
-- icon=/usr/ share/icons/ gnome/48x48/ devices/ audio-speakers. png \
"Volume: $CurrVolume"
LastVolume= $CurrVolume
VolumeCnt= 10
# Ask Ubuntu: https:/
notify-send --urgency=critical "tvpowered" \
-h string:
# TODO: Process VolumeCnt internally in loop instead of larger loop
fi
if [[ $VolumeCnt > 0 ]]; then
SleepTime= .01
SleepTime= 2.5
(( VolumeCnt-- ))
else
fi
sleep $SleepTime
In the link comments point out how this only works in Ubuntu and not in Gnome. It works fine in Ubuntu 16.04.7 LTS with Unity desktop but I haven't tried it on other desktops yet
SleepTime of '0.01' is too small for real time but the bash script has overhead of communicating to TV over WiFi which gives it about the '0.5' seconds lag.