mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-28 10:01:38 +00:00
terminal: expose desktop notification effect
This commit is contained in:
@@ -94,6 +94,7 @@ extern "C" {
|
||||
* | `GHOSTTY_TERMINAL_OPT_COLOR_SCHEME` | `GhosttyTerminalColorSchemeFn` | Color scheme query (CSI ? 996 n) |
|
||||
* | `GHOSTTY_TERMINAL_OPT_DEVICE_ATTRIBUTES`| `GhosttyTerminalDeviceAttributesFn`| Device attributes query (CSI c / > c / = c)|
|
||||
* | `GHOSTTY_TERMINAL_OPT_CLIPBOARD_WRITE` | `GhosttyTerminalClipboardWriteFn` | Clipboard write via OSC 52 / OSC 1337 |
|
||||
* | `GHOSTTY_TERMINAL_OPT_DESKTOP_NOTIFICATION`| `GhosttyTerminalDesktopNotificationFn` | Desktop notification via OSC 9 / OSC 777 |
|
||||
*
|
||||
* ### Defining a write_pty callback
|
||||
* @snippet c-vt-effects/src/main.c effects-write-pty
|
||||
@@ -447,6 +448,42 @@ typedef GhosttyClipboardWriteResult (*GhosttyTerminalClipboardWriteFn)(
|
||||
void* userdata,
|
||||
const GhosttyClipboardWrite* write);
|
||||
|
||||
/**
|
||||
* A request to show a desktop notification.
|
||||
*
|
||||
* This is a sized struct. The callback must only access fields present in the
|
||||
* size reported by `size`. Both strings are borrowed and valid only for the
|
||||
* duration of the callback.
|
||||
*
|
||||
* @ingroup terminal
|
||||
*/
|
||||
typedef struct {
|
||||
/** Size of this struct in bytes. */
|
||||
size_t size;
|
||||
|
||||
/** Notification title, or an empty string when the protocol omits it. */
|
||||
GhosttyString title;
|
||||
|
||||
/** Notification body. */
|
||||
GhosttyString body;
|
||||
} GhosttyTerminalDesktopNotification;
|
||||
|
||||
/**
|
||||
* Callback function type for desktop notifications.
|
||||
*
|
||||
* Called synchronously when the terminal receives OSC 9 or OSC 777.
|
||||
*
|
||||
* @param terminal The terminal handle
|
||||
* @param userdata The userdata pointer set via GHOSTTY_TERMINAL_OPT_USERDATA
|
||||
* @param notification Borrowed desktop notification request
|
||||
*
|
||||
* @ingroup terminal
|
||||
*/
|
||||
typedef void (*GhosttyTerminalDesktopNotificationFn)(
|
||||
GhosttyTerminal terminal,
|
||||
void* userdata,
|
||||
const GhosttyTerminalDesktopNotification* notification);
|
||||
|
||||
/**
|
||||
* Callback function type for color scheme queries (CSI ? 996 n).
|
||||
*
|
||||
@@ -914,6 +951,15 @@ typedef enum GHOSTTY_ENUM_TYPED {
|
||||
* Input type: size_t*
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_SCROLLBACK_MAX_LINES = 28,
|
||||
|
||||
/**
|
||||
* Callback invoked when the running program requests a desktop
|
||||
* notification via OSC 9 or OSC 777. Set to NULL to ignore desktop
|
||||
* notification requests.
|
||||
*
|
||||
* Input type: GhosttyTerminalDesktopNotificationFn
|
||||
*/
|
||||
GHOSTTY_TERMINAL_OPT_DESKTOP_NOTIFICATION = 29,
|
||||
GHOSTTY_TERMINAL_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
|
||||
} GhosttyTerminalOption;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user