aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md6
-rw-r--r--config.c8
-rw-r--r--config.h2
-rw-r--r--csi.c6
-rw-r--r--doc/foot.ini.5.scd3
-rw-r--r--terminal.c3
-rw-r--r--terminal.h3
7 files changed, 21 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7445bb14..4f7765bb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,8 +23,10 @@
(https://codeberg.org/dnkl/foot/issues/150).
* **bell** option to `foot.ini`. Can be set to `set-urgency` to make
foot render the margins in red when receiving `BEL` while **not**
- having keyboard focus. Note that Wayland does **not** implement an
- _urgency_ hint like X11, but that there is a
+ having keyboard focus. Applications can dynamically enable/disable
+ this with the `CSI ? 1042 h` and `CSI ? 1042 l` escape
+ sequences. Note that Wayland does **not** implement an _urgency_
+ hint like X11, but that there is a
[proposal](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/9)
to add support for this. The value `set-urgency` was chosen for
forward-compatibility, in the hopes that this proposal eventualizes
diff --git a/config.c b/config.c
index bcebcb2a..bc7e7426 100644
--- a/config.c
+++ b/config.c
@@ -519,14 +519,14 @@ parse_section_main(const char *key, const char *value, struct config *conf,
else if (strcmp(key, "bell") == 0) {
if (strcmp(value, "set-urgency") == 0)
- conf->bell_set_urgency = true;
+ conf->bell_is_urgent = true;
else if (strcmp(value, "none") == 0)
- conf->bell_set_urgency = false;
+ conf->bell_is_urgent = false;
else {
LOG_AND_NOTIFY_ERR(
"%s:%d: [default]: bell: "
"expected either 'set-urgency' or 'none'", path, lineno);
- conf->bell_set_urgency = false;
+ conf->bell_is_urgent = false;
return false;
}
}
@@ -1902,7 +1902,7 @@ config_load(struct config *conf, const char *conf_path,
},
.pad_x = 2,
.pad_y = 2,
- .bell_set_urgency = false,
+ .bell_is_urgent = false,
.startup_mode = STARTUP_WINDOWED,
.fonts = tll_init(),
.scrollback = {
diff --git a/config.h b/config.h
index 6cbff2e6..d9a6f901 100644
--- a/config.h
+++ b/config.h
@@ -73,7 +73,7 @@ struct config {
unsigned pad_x;
unsigned pad_y;
- bool bell_set_urgency;
+ bool bell_is_urgent;
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
diff --git a/csi.c b/csi.c
index f2ff38be..c1982275 100644
--- a/csi.c
+++ b/csi.c
@@ -476,11 +476,11 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
term->meta.esc_prefix = enable;
break;
-#if 0
case 1042:
- LOG_WARN("unimplemented: 'urgency' window manager hint on ctrl-g");
+ term->bell_is_urgent = enable;
break;
+#if 0
case 1043:
LOG_WARN("unimplemented: raise window on ctrl-g");
break;
@@ -593,6 +593,7 @@ xtsave(struct terminal *term, unsigned param)
case 1015: term->xtsave.mouse_urxvt = term->mouse_reporting == MOUSE_URXVT; break;
case 1034: term->xtsave.meta_eight_bit = term->meta.eight_bit; break;
case 1036: term->xtsave.meta_esc_prefix = term->meta.esc_prefix; break;
+ case 1042: term->xtsave.bell_is_urgent = term->bell_is_urgent; break;
case 1049: term->xtsave.alt_screen = term->grid == &term->alt; break;
case 2004: term->xtsave.bracketed_paste = term->bracketed_paste; break;
}
@@ -624,6 +625,7 @@ xtrestore(struct terminal *term, unsigned param)
case 1015: enable = term->xtsave.mouse_urxvt; break;
case 1034: enable = term->xtsave.meta_eight_bit; break;
case 1036: enable = term->xtsave.meta_esc_prefix; break;
+ case 1042: enable = term->xtsave.bell_is_urgent; break;
case 1049: enable = term->xtsave.alt_screen; break;
case 2004: enable = term->xtsave.bracketed_paste; break;
diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd
index f250c188..371dd7e0 100644
--- a/doc/foot.ini.5.scd
+++ b/doc/foot.ini.5.scd
@@ -103,6 +103,9 @@ in this order:
protocol is added in the future (in which case foot will use that
instead of painting its margins red).
+ Applications can enable/disable this feature programatically with
+ the *CSI ? 1042 h* and *CSI ? 1042 l* escape sequences.
+
_Note_: expect this feature to be *replaced* with proper
compositor urgency support once/if that gets implemented.
diff --git a/terminal.c b/terminal.c
index 0afe39d5..7aacb58c 100644
--- a/terminal.c
+++ b/terminal.c
@@ -996,6 +996,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
.esc_prefix = true,
.eight_bit = true,
},
+ .bell_is_urgent = conf->bell_is_urgent,
.tab_stops = tll_init(),
.wl = wayl,
.render = {
@@ -2374,7 +2375,7 @@ term_flash(struct terminal *term, unsigned duration_ms)
void
term_bell(struct terminal *term)
{
- if (term->kbd_focus || !term->conf->bell_set_urgency)
+ if (term->kbd_focus || !term->bell_is_urgent)
return;
/* There's no 'urgency' hint in Wayland - we just paint the margins red */
diff --git a/terminal.h b/terminal.h
index b6fb2aec..655cb9ce 100644
--- a/terminal.h
+++ b/terminal.h
@@ -251,6 +251,8 @@ struct terminal {
bool eight_bit;
} meta;
+ bool bell_is_urgent;
+
/* Saved DECSET modes - we save the SET state */
struct {
uint32_t origin:1;
@@ -272,6 +274,7 @@ struct terminal {
uint32_t mouse_urxvt:1;
uint32_t meta_eight_bit:1;
uint32_t meta_esc_prefix:1;
+ uint32_t bell_is_urgent:1;
uint32_t alt_screen:1;
} xtsave;