aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-09-05 05:13:53 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-09-05 05:16:15 +0000
commitc5bb1fb2ed33c06078bfec5fb2f487f6406254d0 (patch)
tree809036b72241750f87bf84c875459dbac959f1d9
parentchangelog: strikeout-thickness (diff)
notifications: BEL and OSC-777 now focuses the window on notification activation
Or put more propertly; if the notification daemon, and the notification helper used by foot has been configured properly (i.e. they both support XDG activation tokens), notifications generated by BEL and OSC-777 will now raise/focus the window when the default action of the notification is activated - typically by clicking the notification. Closes #1822
-rw-r--r--CHANGELOG.md8
-rw-r--r--osc.c5
-rw-r--r--terminal.c5
3 files changed, 14 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a2b7aa1..83613505 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -69,6 +69,14 @@
* `cursor.unfocused-style` is now effective even when `cursor.style`
is not `block`.
+* Activating a notification triggered with OSC-777, or BEL, now
+ focuses the foot window, if XDG activation tokens are supported by
+ the compositor, the notification daemon, and the notification helper
+ used by foot (i.e. `desktop-notifications.command`). This has been
+ supported for OSC-99 since 1.18.0, and now we also support it for
+ BEL and OSC-777 ([#1822][1822]).
+
+[1822]: https://codeberg.org/dnkl/foot/issues/1822
### Deprecated
diff --git a/osc.c b/osc.c
index aeb7896c..63b66dd7 100644
--- a/osc.c
+++ b/osc.c
@@ -558,9 +558,10 @@ osc_notify(struct terminal *term, char *string)
}
notify_notify(term, &(struct notification){
- .title = (char *)title,
- .body = (char *)msg,
+ .title = xstrdup(title),
+ .body = xstrdup(msg),
.expire_time = -1,
+ .focus = true,
});
}
diff --git a/terminal.c b/terminal.c
index ecf21040..7e490418 100644
--- a/terminal.c
+++ b/terminal.c
@@ -3597,9 +3597,10 @@ term_bell(struct terminal *term)
if (term->conf->bell.notify) {
notify_notify(term, &(struct notification){
- .title = (char *)"Bell",
- .body = (char *)"Bell in terminal",
+ .title = xstrdup("Bell"),
+ .body = xstrdup("Bell in terminal"),
.expire_time = -1,
+ .focus = true,
});
}