mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
config: add [csd].hide-when-maximized=yes|no
When enabled, the CSD titlebar will be hidden when the window is maximized. Closes #1019
This commit is contained in:
parent
979f48a62f
commit
fbcebd4f1c
6 changed files with 19 additions and 2 deletions
4
config.c
4
config.c
|
|
@ -1361,6 +1361,9 @@ parse_section_csd(struct context *ctx)
|
|||
else if (strcmp(key, "border-width") == 0)
|
||||
return value_to_uint16(ctx, 10, &conf->csd.border_width_visible);
|
||||
|
||||
else if (strcmp(key, "hide-when-maximized") == 0)
|
||||
return value_to_bool(ctx, &conf->csd.hide_when_maximized);
|
||||
|
||||
else {
|
||||
LOG_CONTEXTUAL_ERR("not a valid action: %s", key);
|
||||
return false;
|
||||
|
|
@ -2835,6 +2838,7 @@ config_load(struct config *conf, const char *conf_path,
|
|||
.csd = {
|
||||
.preferred = CONF_CSD_PREFER_SERVER,
|
||||
.font = {0},
|
||||
.hide_when_maximized = false,
|
||||
.title_height = 26,
|
||||
.border_width = 5,
|
||||
.border_width_visible = 0,
|
||||
|
|
|
|||
2
config.h
2
config.h
|
|
@ -262,6 +262,8 @@ struct config {
|
|||
uint16_t border_width_visible;
|
||||
uint16_t button_width;
|
||||
|
||||
bool hide_when_maximized;
|
||||
|
||||
struct {
|
||||
bool title_set:1;
|
||||
bool buttons_set:1;
|
||||
|
|
|
|||
|
|
@ -592,7 +592,9 @@ Examples:
|
|||
|
||||
*size*
|
||||
Height, in pixels (subject to output scaling), of the
|
||||
titlebar. Default: _26_.
|
||||
titlebar. Setting it to 0 will hide the titlebar, while still
|
||||
showing the border (if *border-width* is set to a non-zero
|
||||
value). Default: _26_.
|
||||
|
||||
*color*
|
||||
Titlebar color. Default: use the default _foreground_ color.
|
||||
|
|
@ -603,6 +605,11 @@ Examples:
|
|||
title bar size. That is, all *:size* and *:pixelsize* attributes
|
||||
will be ignored. Default: _primary font_.
|
||||
|
||||
*hide-when-maximized*
|
||||
Boolean. When enabled, the CSD titlebar is hidden when the window
|
||||
is maximized. The completely disable the titlebar, set *size* to 0
|
||||
instead. Default: _no_.
|
||||
|
||||
*border-width*
|
||||
Width of the border, in pixels (subject to output scaling). Note
|
||||
that the border encompasses the entire window, including the title
|
||||
|
|
|
|||
1
foot.ini
1
foot.ini
|
|
@ -110,6 +110,7 @@
|
|||
# size=26
|
||||
# font=<primary font>
|
||||
# color=<foreground color>
|
||||
# hide-when-typing=no
|
||||
# border-width=0
|
||||
# border-color=<csd.color>
|
||||
# button-width=26
|
||||
|
|
|
|||
|
|
@ -666,6 +666,8 @@ test_section_csd(void)
|
|||
&conf.csd.color.maximize);
|
||||
test_color(&ctx, &parse_section_csd, "button-close-color", true,
|
||||
&conf.csd.color.quit);
|
||||
test_boolean(&ctx, &parse_section_csd, "hide-when-maximized",
|
||||
&conf.csd.hide_when_maximized);
|
||||
|
||||
/* TODO: verify the ‘set’ bit is actually set for colors */
|
||||
/* TODO: font */
|
||||
|
|
|
|||
|
|
@ -1768,7 +1768,8 @@ bool
|
|||
wayl_win_csd_titlebar_visible(const struct wl_window *win)
|
||||
{
|
||||
return win->csd_mode == CSD_YES &&
|
||||
!win->is_fullscreen;
|
||||
!win->is_fullscreen &&
|
||||
!(win->is_maximized && win->term->conf->csd.hide_when_maximized);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue