aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorRyan Farley <ryan.farley@gmx.com>2021-04-29 09:12:55 +0000
committerRyan Farley <ryan.farley@gmx.com>2021-05-07 08:12:27 +0000
commit5d71ccc174aafc22053ae0ca98a58ca216737499 (patch)
tree8a222a30054c86c6cf7305a07a230a94f19b80b0 /terminal.c
parentMerge branch 'fix-color-cube' (diff)
enhanced bell configuration
Add a separate section for bell configuration, with a bell-specific command option and a setting to allow that command to run without regard to keyboard focus (for those of us who enjoy being beeped at at all times, for example). The actions are also no longer mutually exclusive; this is primarily anticipating urgency support which cannot be replicated outside the process (in server mode anyway) and would thus be complementary to any notification or arbitrary command.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/terminal.c b/terminal.c
index cd1ecbd9..f77a6d79 100644
--- a/terminal.c
+++ b/terminal.c
@@ -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 && (!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);
}
}