From 76ac910b118147beba276748d2e2aaca0ee066de Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 31 Jul 2024 16:22:17 +0200 Subject: osc: kitty notifications: buttons, icons, app-name, categories etc First, icons have been finalized in the specification. There were only three things we needed to adjust: * symbolic names are base64 encoded * there are a couple of OSC-99 defined symbolic names that need to be translated to the corresponding XDG icon name. * allow in-band icons without a cache ID (that is, allow applications to use p=icon without having to cache the icon first). Second, add support for the following new additions to the protocol: * 'f': custom app-name, overrides the terminal's app-id * 't': categories * 'p=alive': lets applications poll for currently active notifications * 'id' is now 'unset' by default, rather than "0" * 'w': expire time (i.e. notification timeout) * "buttons": aka actions. This lets applications add additional (to the terminal defined "default" action) actions. The 'activated' event has been updated to report which button/action was used to activate the notification. To support button/actions, desktop-notifications.command had to be reworked a bit. There's now a new config option: desktop-notifications.command-action-arg. It has two template arguments ${action-name} and ${action-label}. command-action-arg gets expanded for *each* action. ${action-name} and ${action-label} has been replaced by ${action-arg} in command. This is a somewhat special template, in that it gets replaced by *all* instances of the expanded actions. --- notify.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'notify.h') diff --git a/notify.h b/notify.h index bf19d37c..2a7c5ca1 100644 --- a/notify.h +++ b/notify.h @@ -3,6 +3,8 @@ #include #include +#include + struct terminal; enum notify_when { @@ -30,7 +32,9 @@ struct notification { char *id; char *title; char *body; + char *category; + char *app_id; /* Custm app-id, overrides the terminal's app-id */ char *icon_id; char *icon_symbolic_name; uint8_t *icon_data; @@ -38,6 +42,9 @@ struct notification { enum notify_when when; enum notify_urgency urgency; + int32_t expire_time; + tll(char *) actions; + bool focus; bool may_be_programatically_closed; bool report_activated; @@ -49,6 +56,7 @@ struct notification { uint32_t external_id; /* Daemon assigned notification ID */ bool activated; /* User 'activated' the notification */ + uint32_t activated_button; /* User activated one of the custom actions */ char *xdg_token; /* XDG activation token, from daemon */ pid_t pid; /* Notifier command PID */ @@ -56,6 +64,11 @@ struct notification { char *stdout_data; /* Data we've reado from command's stdout */ size_t stdout_sz; + + /* Used when notification provides raw icon data, and it's + bypassing the icon cache */ + char *icon_path; + int icon_fd; }; struct notification_icon { -- cgit v1.3