2020-12-10 18:06:24 +01:00
|
|
|
#pragma once
|
osc/notify: add support for OSC-99, kitty desktop notifications
This adds limited support for OSC-99, kitty desktop notifications[^1]. We
support everything defined by the "protocol", except:
* 'a': action to perform on notification activation. Since we don't
trigger the notification ourselves (over D-Bus), we don't know a)
which ID the notification got, or b) when it is clicked.
* ... and that's it. Everything else is supported
To be explicit, we *do* support:
* Chunked notifications (d=0|1), allowing the application to append
data to a notification in chunks, before it's finally displayed.
* Plain UTF-8, or base64-encoded UTF-8 payload (e=0|1).
* Notification identifier (i=xyz).
* Payload type (p=title|body).
* When to honor the notification (o=always|unfocused|invisible), with
the following quirks:
- we don't know when the window is invisible, thus it's treated as
'unfocused'.
- the foot option 'notify-focus-inhibit' overrides 'always'
* Urgency (u=0|1|2)
[^1]: https://sw.kovidgoyal.net/kitty/desktop-notifications/
2024-07-19 15:04:28 +02:00
|
|
|
#include <stdbool.h>
|
2020-12-10 18:06:24 +01:00
|
|
|
|
osc/notify: add support for OSC-99, kitty desktop notifications
This adds limited support for OSC-99, kitty desktop notifications[^1]. We
support everything defined by the "protocol", except:
* 'a': action to perform on notification activation. Since we don't
trigger the notification ourselves (over D-Bus), we don't know a)
which ID the notification got, or b) when it is clicked.
* ... and that's it. Everything else is supported
To be explicit, we *do* support:
* Chunked notifications (d=0|1), allowing the application to append
data to a notification in chunks, before it's finally displayed.
* Plain UTF-8, or base64-encoded UTF-8 payload (e=0|1).
* Notification identifier (i=xyz).
* Payload type (p=title|body).
* When to honor the notification (o=always|unfocused|invisible), with
the following quirks:
- we don't know when the window is invisible, thus it's treated as
'unfocused'.
- the foot option 'notify-focus-inhibit' overrides 'always'
* Urgency (u=0|1|2)
[^1]: https://sw.kovidgoyal.net/kitty/desktop-notifications/
2024-07-19 15:04:28 +02:00
|
|
|
struct terminal;
|
|
|
|
|
|
|
|
|
|
enum notify_when {
|
|
|
|
|
NOTIFY_ALWAYS,
|
|
|
|
|
NOTIFY_UNFOCUSED,
|
|
|
|
|
NOTIFY_INVISIBLE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum notify_urgency {
|
|
|
|
|
NOTIFY_URGENCY_LOW,
|
|
|
|
|
NOTIFY_URGENCY_NORMAL,
|
|
|
|
|
NOTIFY_URGENCY_CRITICAL,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct kitty_notification {
|
|
|
|
|
char *id;
|
|
|
|
|
char *title;
|
|
|
|
|
char *body;
|
|
|
|
|
enum notify_when when;
|
|
|
|
|
enum notify_urgency urgency;
|
|
|
|
|
bool focus;
|
|
|
|
|
bool report;
|
|
|
|
|
};
|
2020-12-10 18:06:24 +01:00
|
|
|
|
|
|
|
|
void notify_notify(
|
osc/notify: add support for OSC-99, kitty desktop notifications
This adds limited support for OSC-99, kitty desktop notifications[^1]. We
support everything defined by the "protocol", except:
* 'a': action to perform on notification activation. Since we don't
trigger the notification ourselves (over D-Bus), we don't know a)
which ID the notification got, or b) when it is clicked.
* ... and that's it. Everything else is supported
To be explicit, we *do* support:
* Chunked notifications (d=0|1), allowing the application to append
data to a notification in chunks, before it's finally displayed.
* Plain UTF-8, or base64-encoded UTF-8 payload (e=0|1).
* Notification identifier (i=xyz).
* Payload type (p=title|body).
* When to honor the notification (o=always|unfocused|invisible), with
the following quirks:
- we don't know when the window is invisible, thus it's treated as
'unfocused'.
- the foot option 'notify-focus-inhibit' overrides 'always'
* Urgency (u=0|1|2)
[^1]: https://sw.kovidgoyal.net/kitty/desktop-notifications/
2024-07-19 15:04:28 +02:00
|
|
|
const struct terminal *term, const char *title, const char *body,
|
|
|
|
|
enum notify_when when, enum notify_urgency urgency);
|