mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
commit
b10d93b0ef
10 changed files with 98 additions and 2 deletions
|
|
@ -21,6 +21,14 @@
|
||||||
terminfo). This mode can be enabled/disabled with `CSI ? 45 h` and
|
terminfo). This mode can be enabled/disabled with `CSI ? 45 h` and
|
||||||
`CSI ? 45 l`. It is **enabled** by default
|
`CSI ? 45 l`. It is **enabled** by default
|
||||||
(https://codeberg.org/dnkl/foot/issues/150).
|
(https://codeberg.org/dnkl/foot/issues/150).
|
||||||
|
* **bell** option to `foot.ini`. Can be set to `set-urgency` to make
|
||||||
|
foot render the margins in red when receiving `BEL` while **not**
|
||||||
|
having keyboard focus. Note that Wayland does **not** implement an
|
||||||
|
_urgency_ hint like X11, but that there is a
|
||||||
|
[proposal](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/9)
|
||||||
|
to add support for this. The value `set-urgency` was chosen for
|
||||||
|
forward-compatibility, in the hopes that this proposal eventualizes
|
||||||
|
(https://codeberg.org/dnkl/foot/issues/157).
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
15
config.c
15
config.c
|
|
@ -517,6 +517,20 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
conf->pad_y = y;
|
conf->pad_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "bell") == 0) {
|
||||||
|
if (strcmp(value, "set-urgency") == 0)
|
||||||
|
conf->bell_set_urgency = true;
|
||||||
|
else if (strcmp(value, "none") == 0)
|
||||||
|
conf->bell_set_urgency = false;
|
||||||
|
else {
|
||||||
|
LOG_AND_NOTIFY_ERR(
|
||||||
|
"%s:%d: [default]: bell: "
|
||||||
|
"expected either 'set-urgency' or 'none'", path, lineno);
|
||||||
|
conf->bell_set_urgency = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if (strcmp(key, "initial-window-mode") == 0) {
|
else if (strcmp(key, "initial-window-mode") == 0) {
|
||||||
if (strcmp(value, "windowed") == 0)
|
if (strcmp(value, "windowed") == 0)
|
||||||
conf->startup_mode = STARTUP_WINDOWED;
|
conf->startup_mode = STARTUP_WINDOWED;
|
||||||
|
|
@ -1867,6 +1881,7 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
},
|
},
|
||||||
.pad_x = 2,
|
.pad_x = 2,
|
||||||
.pad_y = 2,
|
.pad_y = 2,
|
||||||
|
.bell_set_urgency = false,
|
||||||
.startup_mode = STARTUP_WINDOWED,
|
.startup_mode = STARTUP_WINDOWED,
|
||||||
.fonts = tll_init(),
|
.fonts = tll_init(),
|
||||||
.scrollback = {
|
.scrollback = {
|
||||||
|
|
|
||||||
2
config.h
2
config.h
|
|
@ -72,6 +72,8 @@ struct config {
|
||||||
unsigned pad_x;
|
unsigned pad_x;
|
||||||
unsigned pad_y;
|
unsigned pad_y;
|
||||||
|
|
||||||
|
bool bell_set_urgency;
|
||||||
|
|
||||||
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
||||||
|
|
||||||
tll(struct config_font) fonts;
|
tll(struct config_font) fonts;
|
||||||
|
|
|
||||||
1
csi.c
1
csi.c
|
|
@ -363,6 +363,7 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
|
||||||
/* DECSCNM */
|
/* DECSCNM */
|
||||||
term->reverse = enable;
|
term->reverse = enable;
|
||||||
term_damage_all(term);
|
term_damage_all(term);
|
||||||
|
term_damage_margins(term);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: {
|
case 6: {
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,25 @@ in this order:
|
||||||
(including SMT). Note that this is not always the best value. In
|
(including SMT). Note that this is not always the best value. In
|
||||||
some cases, the number of physical _cores_ is better.
|
some cases, the number of physical _cores_ is better.
|
||||||
|
|
||||||
|
*bell*
|
||||||
|
Action to perform when receiving a *BEL* character. Can be set to
|
||||||
|
either *set-urgency* or *none*.
|
||||||
|
|
||||||
|
When set to *set-urgency*, the margins will be painted in red
|
||||||
|
whenever *BEL* is received while the window does *not* have
|
||||||
|
keyboard focus. Note that Wayland currently does not have an
|
||||||
|
_urgency_ hint like X11. The value *set-urgency* was chosen for
|
||||||
|
forward-compatibility in the hopes that a corresponding Wayland
|
||||||
|
protocol is added in the future (in which case foot will use that
|
||||||
|
instead of painting its margins red).
|
||||||
|
|
||||||
|
_Note_: expect this feature to be *replaced* with proper
|
||||||
|
compositor urgency support once/if that gets implemented.
|
||||||
|
|
||||||
|
When set to *none*, no special action is taken when receiving *BEL*.
|
||||||
|
|
||||||
|
Default: _none_.
|
||||||
|
|
||||||
|
|
||||||
# SECTION: scrollback
|
# SECTION: scrollback
|
||||||
|
|
||||||
|
|
|
||||||
1
foot.ini
1
foot.ini
|
|
@ -9,6 +9,7 @@
|
||||||
# term=foot
|
# term=foot
|
||||||
# login-shell=no
|
# login-shell=no
|
||||||
# workers=<number of logical CPUs>
|
# workers=<number of logical CPUs>
|
||||||
|
# bell=none
|
||||||
|
|
||||||
[scrollback]
|
[scrollback]
|
||||||
# lines=1000
|
# lines=1000
|
||||||
|
|
|
||||||
32
render.c
32
render.c
|
|
@ -541,6 +541,35 @@ draw_cursor:
|
||||||
return cell_cols;
|
return cell_cols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
render_urgency(struct terminal *term, struct buffer *buf)
|
||||||
|
{
|
||||||
|
uint32_t red = term->colors.table[1];
|
||||||
|
pixman_color_t bg = color_hex_to_pixman(red);
|
||||||
|
|
||||||
|
if (term->is_searching)
|
||||||
|
color_dim(&bg);
|
||||||
|
|
||||||
|
int width = min(min(term->margins.left, term->margins.right),
|
||||||
|
min(term->margins.top, term->margins.bottom));
|
||||||
|
|
||||||
|
pixman_image_fill_rectangles(
|
||||||
|
PIXMAN_OP_SRC, buf->pix[0], &bg, 4,
|
||||||
|
(pixman_rectangle16_t[]){
|
||||||
|
/* Top */
|
||||||
|
{0, 0, term->width, width},
|
||||||
|
|
||||||
|
/* Bottom */
|
||||||
|
{0, term->height - width, term->width, width},
|
||||||
|
|
||||||
|
/* Left */
|
||||||
|
{0, width, width, term->height - 2 * width},
|
||||||
|
|
||||||
|
/* Right */
|
||||||
|
{term->width - width, width, width, term->height - 2 * width},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
render_margin(struct terminal *term, struct buffer *buf,
|
render_margin(struct terminal *term, struct buffer *buf,
|
||||||
int start_line, int end_line, bool apply_damage)
|
int start_line, int end_line, bool apply_damage)
|
||||||
|
|
@ -578,6 +607,9 @@ render_margin(struct terminal *term, struct buffer *buf,
|
||||||
term->margins.right, line_count * term->cell_height},
|
term->margins.right, line_count * term->cell_height},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (term->render.urgency)
|
||||||
|
render_urgency(term, buf);
|
||||||
|
|
||||||
if (apply_damage) {
|
if (apply_damage) {
|
||||||
/* Top */
|
/* Top */
|
||||||
wl_surface_damage_buffer(
|
wl_surface_damage_buffer(
|
||||||
|
|
|
||||||
17
terminal.c
17
terminal.c
|
|
@ -2073,6 +2073,12 @@ term_kbd_focus_in(struct terminal *term)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
term->kbd_focus = true;
|
term->kbd_focus = true;
|
||||||
|
|
||||||
|
if (term->render.urgency) {
|
||||||
|
term->render.urgency = false;
|
||||||
|
term_damage_margins(term);
|
||||||
|
}
|
||||||
|
|
||||||
cursor_refresh(term);
|
cursor_refresh(term);
|
||||||
|
|
||||||
if (term->focus_events)
|
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
|
bool
|
||||||
term_spawn_new(const struct terminal *term)
|
term_spawn_new(const struct terminal *term)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -389,6 +389,7 @@ struct terminal {
|
||||||
} pending;
|
} pending;
|
||||||
|
|
||||||
bool margins; /* Someone explicitly requested a refresh of the margins */
|
bool margins; /* Someone explicitly requested a refresh of the margins */
|
||||||
|
bool urgency; /* Signal 'urgency' (paint borders red) */
|
||||||
|
|
||||||
int scrollback_lines; /* Number of scrollback lines, from conf (TODO: move out from render struct?) */
|
int scrollback_lines; /* Number of scrollback lines, from conf (TODO: move out from render struct?) */
|
||||||
|
|
||||||
|
|
@ -574,6 +575,7 @@ void term_xcursor_update_for_seat(struct terminal *term, struct seat *seat);
|
||||||
|
|
||||||
void term_set_window_title(struct terminal *term, const char *title);
|
void term_set_window_title(struct terminal *term, const char *title);
|
||||||
void term_flash(struct terminal *term, unsigned duration_ms);
|
void term_flash(struct terminal *term, unsigned duration_ms);
|
||||||
|
void term_bell(struct terminal *term);
|
||||||
bool term_spawn_new(const struct terminal *term);
|
bool term_spawn_new(const struct terminal *term);
|
||||||
|
|
||||||
void term_enable_app_sync_updates(struct terminal *term);
|
void term_enable_app_sync_updates(struct terminal *term);
|
||||||
|
|
|
||||||
3
vt.c
3
vt.c
|
|
@ -124,8 +124,7 @@ action_execute(struct terminal *term, uint8_t c)
|
||||||
|
|
||||||
case '\a':
|
case '\a':
|
||||||
/* BEL - bell */
|
/* BEL - bell */
|
||||||
// LOG_INFO("BELL");
|
term_bell(term);
|
||||||
// term_flash(term, 50);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\b':
|
case '\b':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue