diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-05-07 14:47:53 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-05-07 14:47:53 +0000 |
| commit | 63572e4223a329f6942041d8ca8fce5016fc3a1f (patch) | |
| tree | 519a249b6809b3dc5ce1cd2ce622e53d2cae5654 /terminal.c | |
| parent | Merge branch 'bump-fcft-to-2-4-0' (diff) | |
| parent | consistent booleans in config, reset legacy bell (diff) | |
Merge branch 'bell-enhancement'
Diffstat (limited to 'terminal.c')
| -rw-r--r-- | terminal.c | 29 |
1 files changed, 16 insertions, 13 deletions
@@ -2627,23 +2627,26 @@ term_flash(struct terminal *term, unsigned duration_ms) void term_bell(struct terminal *term) { - if (term->kbd_focus || !term->bell_action_enabled) + if (!term->bell_action_enabled) return; - switch (term->conf->bell_action) { - case BELL_ACTION_NONE: - break; + if (!term->kbd_focus) { + if (term->conf->bell.urgent) { + /* There's no 'urgency' hint in Wayland - we just paint the + * margins red */ + term->render.urgency = true; + term_damage_margins(term); + } + if (term->conf->bell.notify) + notify_notify(term, "Bell", "Bell in terminal"); + } - 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; + if ((term->conf->bell.command.argv != NULL) && (!term->kbd_focus || term->conf->bell.command_focused)) { + int devnull = open("/dev/null", O_RDONLY); + spawn(term->reaper, NULL, term->conf->bell.command.argv, devnull, -1, -1); - case BELL_ACTION_NOTIFY: - notify_notify(term, "Bell", "Bell in terminal"); - break; + if (devnull >= 0) + close(devnull); } } |
