From 7c6686221f328e9399eb679c246662c801b2356b Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 8 Oct 2020 19:55:32 +0200 Subject: bell: optionally render margins in red when receiving BEL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add anew config option, ‘bell=none|set-urgency’. When set to ‘set-urgency’, the margins will be painted in red (if the window did not have keyboard focus). This is intended as a cheap replacement for the ‘urgency’ hint, that doesn’t (yet) exist on Wayland. Closes #157 --- terminal.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index c05d71d4..077d15f0 100644 --- a/terminal.c +++ b/terminal.c @@ -2073,6 +2073,12 @@ term_kbd_focus_in(struct terminal *term) return; term->kbd_focus = true; + + if (term->render.urgency) { + term->render.urgency = false; + term_damage_margins(term); + } + cursor_refresh(term); if (term->focus_events) @@ -2363,6 +2369,17 @@ term_flash(struct terminal *term, unsigned duration_ms) } } +void +term_bell(struct terminal *term) +{ + if (term->kbd_focus || !term->conf->bell_set_urgency) + return; + + /* There's no 'urgency' hint in Wayland - we just paint the margins red */ + term->render.urgency = true; + term_damage_margins(term); +} + bool term_spawn_new(const struct terminal *term) { -- cgit v1.3