notify: separate active notifications from unfinished kitty notifications

This fixes an issue where it wasn't possible to trigger multiple
notifications with the same kitty notification ID. This is something
that works in kitty, and there's no reason why it shouldn't work.

The issue was that we track stdout, and the notification helper's PID
in the notification struct. Thus, when a notification is being
displayed, we can't re-use the same notification struct instance for
another notification.

This patch fixes this by adding a new notification list,
'active_notifications'. Whenever we detect that we need to track the
helper (notification want's to either focus the window on activation,
or send an event to the application), we add a copy of the
notification to the 'active' list.

The notification can then be removed from the 'kitty' list, allowing
kitty notifications to re-use the same ID over and over again, even if
old notifications are still being displayed.
This commit is contained in:
Daniel Eklöf 2024-07-23 11:53:30 +02:00
parent ccb184ae64
commit b3108e1ad2
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 57 additions and 30 deletions

View file

@ -801,7 +801,8 @@ struct terminal {
/* Notifications that either haven't been sent yet, or have been
sent but not yet dismissed */
tll(struct notification) notifications;
tll(struct notification) kitty_notifications;
tll(struct notification) active_notifications;
struct notification_icon notification_icons[32];
char *foot_exe;