diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-12-10 17:22:48 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-12-10 17:22:48 +0000 |
| commit | 15d20af2a24664b09604f1ec5f121c38f1500c32 (patch) | |
| tree | 34d9ab652f1c24399f098aafc5b80ad4de9e6016 /terminal.c | |
| parent | notify: don’t emit notification when we’re focused (diff) | |
config: add ‘notify’ to possible values for ‘bell’ in foot.ini
When `bell=notify`, foot will trigger a desktop notification when it
receives a BEL in an unfocused window.
Diffstat (limited to 'terminal.c')
| -rw-r--r-- | terminal.c | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -25,6 +25,7 @@ #include "extract.h" #include "grid.h" #include "ime.h" +#include "notify.h" #include "quirks.h" #include "reaper.h" #include "render.h" @@ -1091,7 +1092,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper, .eight_bit = true, }, .num_lock_modifier = true, - .bell_is_urgent = conf->bell_is_urgent, + .bell_action_enabled = true, .tab_stops = tll_init(), .wl = wayl, .render = { @@ -1532,6 +1533,8 @@ term_reset(struct terminal *term, bool hard) term->bracketed_paste = false; term->focus_events = false; term->modify_escape_key = false; + term->num_lock_modifier = true; + term->bell_action_enabled = true; term->mouse_tracking = MOUSE_NONE; term->mouse_reporting = MOUSE_NORMAL; term->charsets.selected = 0; @@ -2512,12 +2515,24 @@ term_flash(struct terminal *term, unsigned duration_ms) void term_bell(struct terminal *term) { - if (term->kbd_focus || !term->bell_is_urgent) + if (term->kbd_focus || !term->bell_action_enabled) return; - /* There's no 'urgency' hint in Wayland - we just paint the margins red */ - term->render.urgency = true; - term_damage_margins(term); + switch (term->conf->bell_action) { + case BELL_ACTION_NONE: + break; + + case BELL_ACTION_URGENT: + /* There's no 'urgency' hint in Wayland - we just paint the + * margins red */ + term->render.urgency = true; + term_damage_margins(term); + break; + + case BELL_ACTION_NOTIFY: + notify_notify(term, "Bell", "Bell in terminal"); + break; + } } bool |
