aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-10-27 16:27:08 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-10-27 16:32:28 +0000
commit5e4de143de6c43ab54a5df7cea169674f8ea79a3 (patch)
tree4a1a32bd11b103764c2077780758cc52fff16746 /config.c
parentmeson: install themes to $datadir/foot/themes (diff)
csd: add support for a visible border
When we’re using CSDs, we’ve up until now rendered a 5px invisible border. This border handles interactive resizing. I.e. hovering it changes the mouse cursor, and mouse button events are used to start an interactive resize. This patch makes it possible to color part of (or the entire) border, with a configurable color. To facilitate this, two new options have been added: * csd.border-width * csd.border-color border-width defaults to 0, resulting in the look we’re used to. border-color defaults to the title bar color. If the title bar color hasn’t been set, it defaults to the default foreground color (just like the title bar color does). This means that, setting border-width but not border-color, results in a border that blends with the title bar.
Diffstat (limited to 'config.c')
-rw-r--r--config.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/config.c b/config.c
index bd9ebbf2..4e772aa1 100644
--- a/config.c
+++ b/config.c
@@ -1489,7 +1489,9 @@ parse_section_csd(const char *key, const char *value, struct config *conf,
else if (strcmp(key, "size") == 0) {
unsigned long pixels;
if (!str_to_ulong(value, 10, &pixels)) {
- LOG_AND_NOTIFY_ERR("%s:%d: expected an integer, got '%s'", path, lineno, value);
+ LOG_AND_NOTIFY_ERR(
+ "%s:%d: [csd]: size: expected an integer, got '%s'",
+ path, lineno, value);
return false;
}
@@ -1499,7 +1501,9 @@ parse_section_csd(const char *key, const char *value, struct config *conf,
else if (strcmp(key, "button-width") == 0) {
unsigned long pixels;
if (!str_to_ulong(value, 10, &pixels)) {
- LOG_AND_NOTIFY_ERR("%s:%d: expected an integer, got '%s'", path, lineno, value);
+ LOG_AND_NOTIFY_ERR(
+ "%s:%d: [csd]: button-width: expected an integer, got '%s'",
+ path, lineno, value);
return false;
}
@@ -1542,6 +1546,27 @@ parse_section_csd(const char *key, const char *value, struct config *conf,
conf->csd.color.close = color;
}
+ else if (strcmp(key, "border-color") == 0) {
+ uint32_t color;
+ if (!str_to_color(value, &color, true, conf, path, lineno, "csd", "border-color"))
+ return false;
+
+ conf->csd.color.border_set = true;
+ conf->csd.color.border = color;
+ }
+
+ else if (strcmp(key, "border-width") == 0) {
+ unsigned long width;
+ if (!str_to_ulong(value, 10, &width)) {
+ LOG_AND_NOTIFY_ERR(
+ "%s:%u: [csd]: border-width: expected an integer, got '%s'",
+ path, lineno, value);
+ return false;
+ }
+
+ conf->csd.border_width_visible = width;
+ }
+
else {
LOG_AND_NOTIFY_ERR("%s:%u: [csd]: %s: invalid action",
path, lineno, key);