mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
Merge branch 'csd-button-fg-color'
This commit is contained in:
commit
8177dbcc86
6 changed files with 43 additions and 10 deletions
|
|
@ -67,6 +67,7 @@
|
|||
(https://codeberg.org/dnkl/foot/issues/554).
|
||||
* `underline-offset` option to `foot.ini`
|
||||
(https://codeberg.org/dnkl/foot/issues/490).
|
||||
* `csd.button-color` option to `foot.ini`.
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
11
config.c
11
config.c
|
|
@ -1316,6 +1316,17 @@ parse_section_csd(const char *key, const char *value, struct config *conf,
|
|||
conf->csd.button_width = pixels;
|
||||
}
|
||||
|
||||
else if (strcmp(key, "button-color") == 0) {
|
||||
uint32_t color;
|
||||
if (!str_to_color(value, &color, true, conf, path, lineno, "csd", "button-color")) {
|
||||
LOG_AND_NOTIFY_ERR("%s:%d: invalid button-color: %s", path, lineno, value);
|
||||
return false;
|
||||
}
|
||||
|
||||
conf->csd.color.buttons_set = true;
|
||||
conf->csd.color.buttons = color;
|
||||
}
|
||||
|
||||
else if (strcmp(key, "button-minimize-color") == 0) {
|
||||
uint32_t color;
|
||||
if (!str_to_color(value, &color, true, conf, path, lineno, "csd", "button-minimize-color")) {
|
||||
|
|
|
|||
2
config.h
2
config.h
|
|
@ -214,10 +214,12 @@ struct config {
|
|||
|
||||
struct {
|
||||
bool title_set:1;
|
||||
bool buttons_set:1;
|
||||
bool minimize_set:1;
|
||||
bool maximize_set:1;
|
||||
bool close_set:1;
|
||||
uint32_t title;
|
||||
uint32_t buttons;
|
||||
uint32_t minimize;
|
||||
uint32_t maximize;
|
||||
uint32_t close;
|
||||
|
|
|
|||
|
|
@ -518,17 +518,21 @@ component.
|
|||
Width, in pixels (subject to output scaling), of the
|
||||
minimize/maximize/close buttons. Default: _26_.
|
||||
|
||||
*button-color*
|
||||
Foreground color on the minimize/maximize/close buttons. Default:
|
||||
use the default _background_ color.
|
||||
|
||||
*button-minimize-color*
|
||||
Minimize button's AARRGGBB color. Default: use the default
|
||||
_regular4_ color (blue).
|
||||
Minimize button's background color, on the format
|
||||
AARRGGBB. Default: use the default _regular4_ color (blue).
|
||||
|
||||
*button-maximize-color*
|
||||
Maximize button's AARRGGBB color. Default: use the default
|
||||
_regular2_ color (green).
|
||||
Maximize button's background color, on the format
|
||||
AARRGGBB. Default: use the default _regular2_ color (green).
|
||||
|
||||
*button-close-color*
|
||||
Close button's AARRGGBB color. Default: use the default _regular1_
|
||||
color (red).
|
||||
Close button's background color, on the format AARRGGBB. Default:
|
||||
use the default _regular1_ color (red).
|
||||
|
||||
|
||||
# SECTION: key-bindings
|
||||
|
|
|
|||
1
foot.ini
1
foot.ini
|
|
@ -92,6 +92,7 @@
|
|||
# size=26
|
||||
# color=<foreground color>
|
||||
# button-width=26
|
||||
# button-color=<background color>
|
||||
# button-minimize-color=<regular4>
|
||||
# button-maximize-color=<regular2>
|
||||
# button-close-color=<regular1>
|
||||
|
|
|
|||
22
render.c
22
render.c
|
|
@ -1580,10 +1580,24 @@ render_csd_border(struct terminal *term, enum csd_surface surf_idx)
|
|||
csd_commit(term, surf, buf);
|
||||
}
|
||||
|
||||
static pixman_color_t
|
||||
get_csd_button_fg_color(const struct config *conf)
|
||||
{
|
||||
uint32_t _color = conf->colors.bg;
|
||||
uint16_t alpha = 0xffff;
|
||||
|
||||
if (conf->csd.color.buttons_set) {
|
||||
_color = conf->csd.color.buttons;
|
||||
alpha = _color >> 24 | (_color >> 24 << 8);
|
||||
}
|
||||
|
||||
return color_hex_to_pixman_with_alpha(_color, alpha);
|
||||
}
|
||||
|
||||
static void
|
||||
render_csd_button_minimize(struct terminal *term, struct buffer *buf)
|
||||
{
|
||||
pixman_color_t color = color_hex_to_pixman(term->conf->colors.bg);
|
||||
pixman_color_t color = get_csd_button_fg_color(term->conf);
|
||||
pixman_image_t *src = pixman_image_create_solid_fill(&color);
|
||||
|
||||
const int max_height = buf->height / 2;
|
||||
|
|
@ -1628,7 +1642,7 @@ static void
|
|||
render_csd_button_maximize_maximized(
|
||||
struct terminal *term, struct buffer *buf)
|
||||
{
|
||||
pixman_color_t color = color_hex_to_pixman(term->conf->colors.bg);
|
||||
pixman_color_t color = get_csd_button_fg_color(term->conf);
|
||||
pixman_image_t *src = pixman_image_create_solid_fill(&color);
|
||||
|
||||
const int max_height = buf->height / 3;
|
||||
|
|
@ -1656,7 +1670,7 @@ static void
|
|||
render_csd_button_maximize_window(
|
||||
struct terminal *term, struct buffer *buf)
|
||||
{
|
||||
pixman_color_t color = color_hex_to_pixman(term->conf->colors.bg);
|
||||
pixman_color_t color = get_csd_button_fg_color(term->conf);
|
||||
pixman_image_t *src = pixman_image_create_solid_fill(&color);
|
||||
|
||||
const int max_height = buf->height / 2;
|
||||
|
|
@ -1710,7 +1724,7 @@ render_csd_button_maximize(struct terminal *term, struct buffer *buf)
|
|||
static void
|
||||
render_csd_button_close(struct terminal *term, struct buffer *buf)
|
||||
{
|
||||
pixman_color_t color = color_hex_to_pixman(term->conf->colors.bg);
|
||||
pixman_color_t color = get_csd_button_fg_color(term->conf);
|
||||
pixman_image_t *src = pixman_image_create_solid_fill(&color);
|
||||
|
||||
const int max_height = buf->height / 3;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue