How does "Clear All Notifications" button work?

I’m trying to create a shortcut to clear all notifications, but I can’s find any way to do that. There is already a button in Notifications plasmoid - does anyone know how it works (or where I can find source code for it)? I’ve looked in plasma-desktop already, but couldn’t find it.

I think I found a solution - I was looking into plasma-desktop instead of plasma-workspace repository (duh)

I will see if there is some way to translate this into command line interface

1 Like

Sorry, it wasn’t the “clear all notifications” button that I was originally looking for - I just wanted to remove all notifications from the screen with a shortcut:

for i in $(seq $(notify-send -p " " -t 1) -1 0); do qdbus org.kde.plasmashell /org/freedesktop/Notifications org.freedesktop.Notifications.CloseNotification $i; done

now this script is suboptimal - it creates a new notification to get currently highest id and then removes all notifications with smaller ids - there could be maybe only two or three, but it may iterate through hundreds.

If anyone knows any way to get the actual list of current notifications (on the screen, not in the plasmoid) please let me know.