mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-27 07:58:07 -04:00
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.
This commit is contained in:
parent
8cb95018c0
commit
5d71ccc174
5 changed files with 96 additions and 63 deletions
29
terminal.c
29
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue