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
        # 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.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to libnotify in Ubuntu.
https://bugs.launchpad.net/bugs/257135

Title:
  notify-send(1) can't replace an existing notification

Status in libnotify package in Ubuntu:
  Confirmed
Status in libnotify package in Debian:
  New

Bug description:
  Binary package hint: libnotify-bin

  Ubuntu 8.04, libnotify-bin 0.4.4-3build1.

  notify-send(1) is very useful but it doesn't tell me the notification
  ID that's been created, nor does it let me specify that to replace an
  earlier notification.  See http://www.galago-
  project.org/specs/notification/0.9/x408.html#command-notify, in
  particular the replaces_id parameter and the return value.

  I'd like to be able to use it something like

      id=$(notify-send --show-id foo)
      sleep 60
      notify-send --replace $id bar

  This would be great for long-running shell scripts that are monitoring
  something.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libnotify/+bug/257135/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to