mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-23 01:40:12 -05:00
osc: kitty notifications: cleanup and update to latest version of spec
* Don't store a list of unfinished notifications. Use a single one. If
the notification ID of the 'current' notification doesn't match the
previous, unfinished one, the 'current' notification replaces the
previous one, instead of updating it.
* Update xstrjoin() to take an optional delimiter (for example ','),
and use that when joining categories and 'alive IDs'.
* Rename ${action-arg} to ${action-argument}
* Update handling of the 'n' parameter (symbolic icon name); the spec
allows it to be used multiple times, and the terminal is supposed to
pick the first one it can resolve. Foot can't resolve icons at all,
neither can 'notify-send' or 'fyi' (which is what foot typically
executes to display a notification); it's the notification daemon that
resolves icons.
The spec _could_ be interpreted to mean the terminal should lookup
.desktop files, and use the value of the 'Icon' key from the first
matching .desktop files. But foot doesn't read .desktop files, and I
don't intend to implement XDG directory scanning and parsing of
.desktop files just to figure out which icon to use.
Instead, use a simple heuristics; use the *shortest* symbolic
names. The idea is pretty simple: plain icon names are typically
shorter than .desktop file IDs.
This commit is contained in:
parent
18b87b2e20
commit
ea2f0e7c3f
12 changed files with 296 additions and 247 deletions
27
notify.h
27
notify.h
|
|
@ -29,26 +29,28 @@ struct notification {
|
|||
/*
|
||||
* Set by caller of notify_notify()
|
||||
*/
|
||||
char *id;
|
||||
char *title;
|
||||
char *id; /* Internal notification ID */
|
||||
|
||||
char *app_id; /* Custom app-id, overrides the terminal's app-id if set */
|
||||
char *title; /* Required */
|
||||
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;
|
||||
size_t icon_data_sz;
|
||||
|
||||
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;
|
||||
bool report_closed;
|
||||
char *icon_cache_id;
|
||||
char *icon_symbolic_name;
|
||||
uint8_t *icon_data;
|
||||
size_t icon_data_sz;
|
||||
|
||||
bool focus; /* Focus the foot window when notification is activated */
|
||||
bool may_be_programatically_closed; /* OSC-99: notification may be programatically closed by the client */
|
||||
bool report_activated; /* OSC-99: report notification activation to client */
|
||||
bool report_closed; /* OSC-99: report notification closed to client */
|
||||
|
||||
/*
|
||||
* Used internally by notify
|
||||
|
|
@ -56,6 +58,7 @@ struct notification {
|
|||
|
||||
uint32_t external_id; /* Daemon assigned notification ID */
|
||||
bool activated; /* User 'activated' the notification */
|
||||
uint32_t button_count; /* Number of buttons (custom actions) in notification */
|
||||
uint32_t activated_button; /* User activated one of the custom actions */
|
||||
char *xdg_token; /* XDG activation token, from daemon */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue