aboutsummaryrefslogtreecommitdiff
path: root/tests/test-config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-23 04:59:46 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-23 05:17:21 +0000
commit5905ea0d84530c85899292e38be4cd98156f7cbf (patch)
tree543c00d0ffadcf92acdb12eb7517679c42c4ad5e /tests/test-config.c
parentunicode-mode: disable debug logging (diff)
osc: kitty notifications: implement focus|report
This patch adds support for window focusing, and sending events back to the client application when a notification is closed. * Refactor notification related configuration options: - add desktop-notifications sub-section - deprecate 'notify' in favor of 'desktop-notifications.command' - deprecate 'notify-focus-inhibit' in favor of 'desktop-notifications.inhibit-when-focused' * Refactor: rename 'struct kitty_notification' to 'struct notification' * Pass a 'struct notification' to notify_notify(), instead of many arguments. * notify_notify() now registers a reaper callback. When the notifier process has terminated, the notification is considered closed, and we either try to focus (activate) the window, or send an event to the client application, depending on the notification setting. * For the window activation, we need an XDG activation token. For now, assume *everything* written on stdout is part of the token. * Refactor: remove much of the warnings from OSC-99; we don't typically log anything when an OSC/CSI has invalid values. * Add icon support to OSC-99. This isn't part of the upstream spec. Foot's implementation: - uses the 'I' parameter - the value is expected to be a symbolic icon name - a quick check for absolute paths is done, and such icon requests are ignored. * Added ${icon} to the 'desktop-notifications.command' template. Uses the icon specified in the notification, or ${app-id} if not set.
Diffstat (limited to 'tests/test-config.c')
-rw-r--r--tests/test-config.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/test-config.c b/tests/test-config.c
index 4a0fd755..ec718c24 100644
--- a/tests/test-config.c
+++ b/tests/test-config.c
@@ -511,7 +511,7 @@ test_section_main(void)
test_boolean(&ctx, &parse_section_main, "login-shell", &conf.login_shell);
test_boolean(&ctx, &parse_section_main, "box-drawings-uses-font-glyphs", &conf.box_drawings_uses_font_glyphs);
test_boolean(&ctx, &parse_section_main, "locked-title", &conf.locked_title);
- test_boolean(&ctx, &parse_section_main, "notify-focus-inhibit", &conf.notify_focus_inhibit);
+ test_boolean(&ctx, &parse_section_main, "notify-focus-inhibit", &conf.desktop_notifications.inhibit_when_focused); /* Deprecated */
test_boolean(&ctx, &parse_section_main, "dpi-aware", &conf.dpi_aware);
test_pt_or_px(&ctx, &parse_section_main, "font-size-adjustment", &conf.font_size_adjustment.pt_or_px); /* TODO: test ‘N%’ values too */
@@ -524,7 +524,7 @@ test_section_main(void)
test_uint16(&ctx, &parse_section_main, "resize-delay-ms", &conf.resize_delay_ms);
test_uint16(&ctx, &parse_section_main, "workers", &conf.render_worker_count);
- test_spawn_template(&ctx, &parse_section_main, "notify", &conf.notify);
+ test_spawn_template(&ctx, &parse_section_main, "notify", &conf.desktop_notifications.command); /* Deprecated */
test_enum(&ctx, &parse_section_main, "selection-target",
4,
@@ -571,6 +571,20 @@ test_section_bell(void)
}
static void
+test_section_desktop_notifications(void)
+{
+ struct config conf = {0};
+ struct context ctx = {.conf = &conf, .section = "desktop-notifications", .path = "unittest"};
+
+ test_invalid_key(&ctx, &parse_section_desktop_notifications, "invalid-key");
+
+ test_boolean(&ctx, &parse_section_desktop_notifications, "inhibit-when-focused", &conf.desktop_notifications.inhibit_when_focused);
+ test_spawn_template(&ctx, &parse_section_desktop_notifications, "command", &conf.desktop_notifications.command);
+
+ config_free(&conf);
+}
+
+static void
test_section_scrollback(void)
{
struct config conf = {0};
@@ -1391,6 +1405,7 @@ main(int argc, const char *const *argv)
log_init(LOG_COLORIZE_AUTO, false, 0, LOG_CLASS_ERROR);
test_section_main();
test_section_bell();
+ test_section_desktop_notifications();
test_section_scrollback();
test_section_url();
test_section_cursor();