mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-02 07:15:31 -04:00
bell: optionally render margins in red when receiving BEL
Add anew config option, ‘bell=none|set-urgency’. When set to ‘set-urgency’, the margins will be painted in red (if the window did not have keyboard focus). This is intended as a cheap replacement for the ‘urgency’ hint, that doesn’t (yet) exist on Wayland. Closes #157
This commit is contained in:
parent
7e0cfd46c6
commit
7c6686221f
10 changed files with 95 additions and 2 deletions
32
render.c
32
render.c
|
|
@ -541,6 +541,35 @@ draw_cursor:
|
|||
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
|
||||
render_margin(struct terminal *term, struct buffer *buf,
|
||||
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},
|
||||
});
|
||||
|
||||
if (term->render.urgency)
|
||||
render_urgency(term, buf);
|
||||
|
||||
if (apply_damage) {
|
||||
/* Top */
|
||||
wl_surface_damage_buffer(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue