osd: add theme settings for window-switcher preview

Adds theme settings like:
osd.window-switcher.preview.border.width: 2
osd.window-switcher.preview.border.color: #ffffff,#00a2ff,#ffffff
This commit is contained in:
tokyo4j 2024-04-15 20:22:44 +09:00 committed by Consolatis
parent 2c0e76417f
commit 8096df19ba
5 changed files with 44 additions and 10 deletions

View file

@ -523,6 +523,12 @@ theme_builtin(struct theme *theme)
theme->osd_window_switcher_item_padding_y = 1;
theme->osd_window_switcher_item_active_border_width = 2;
/* inherit settings in post_processing() if not set elsewhere */
theme->osd_window_switcher_preview_border_width = INT_MIN;
memset(theme->osd_window_switcher_preview_border_color, 0,
sizeof(theme->osd_window_switcher_preview_border_color));
theme->osd_window_switcher_preview_border_color[0][0] = FLT_MIN;
theme->osd_workspace_switcher_boxes_width = 20;
theme->osd_workspace_switcher_boxes_height = 20;
@ -733,6 +739,12 @@ entry(struct theme *theme, const char *key, const char *value)
if (match_glob(key, "osd.window-switcher.item.active.border.width")) {
theme->osd_window_switcher_item_active_border_width = atoi(value);
}
if (match_glob(key, "osd.window-switcher.preview.border.width")) {
theme->osd_window_switcher_preview_border_width = atoi(value);
}
if (match_glob(key, "osd.window-switcher.preview.border.color")) {
parse_hexstrs(value, theme->osd_window_switcher_preview_border_color);
}
if (match_glob(key, "osd.workspace-switcher.boxes.width")) {
theme->osd_workspace_switcher_boxes_width = atoi(value);
}
@ -1092,6 +1104,14 @@ post_processing(struct theme *theme)
theme->osd_window_switcher_width =
MIN(theme->osd_window_switcher_width, 100);
}
if (theme->osd_window_switcher_preview_border_width == INT_MIN) {
theme->osd_window_switcher_preview_border_width =
theme->osd_border_width;
}
if (theme->osd_window_switcher_preview_border_color[0][0] == FLT_MIN) {
fill_colors_with_osd_theme(theme,
theme->osd_window_switcher_preview_border_color);
}
if (theme->snapping_preview_region_border_width == INT_MIN) {
theme->snapping_preview_region_border_width =