02-15-2021, 01:41 PM 
		
	
	
		Hello there,
found myself in a similar situation with a lot of notifications. With some digging, I put the following script together - dirty hack, I know, but it does the trick for at least 50 notifications. Everything after takes a lot of time to loop around.
But since the notification server is counting up and restarting only with Phosh restarting, the numbers go higher with every notification.
I also tried a detecting approach
But this fails, since the ouput of dbus-monitor of an existing&closed notification is similar to a non-existing&fake-closed notification. And the script is getting slower...
But feel free to play around with the second script code.
My next steps will be some double if-conditions... Maybe.
Cheers
	
	
	
	
found myself in a similar situation with a lot of notifications. With some digging, I put the following script together - dirty hack, I know, but it does the trick for at least 50 notifications. Everything after takes a lot of time to loop around.
Code:
#!/bin/bash
for i in {1..50}
  do
    gdbus call --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications --method org.freedesktop.Notifications.CloseNotification $i
  done
exit 0But since the notification server is counting up and restarting only with Phosh restarting, the numbers go higher with every notification.
I also tried a detecting approach
Code:
#!/bin/bash
for i in {1..10}
  do
    output=$(dbus-monitor "interface='org.freedesktop.Notifications'") & gdbus call --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications --method org.freedesktop.Notifications.CloseNotification $i & pkill dbus-monitor
    if ! grep -q NameLost <<< $output; then
      break
    fi
  done
echo 'done'
exit 0But this fails, since the ouput of dbus-monitor of an existing&closed notification is similar to a non-existing&fake-closed notification. And the script is getting slower...
But feel free to play around with the second script code.
My next steps will be some double if-conditions... Maybe.
Cheers

