Skip to content

RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process

Use theme tokens for Settings styling

oxydizer92c90c738e9a
diff --git a/docs/themes.md b/docs/themes.md
index 896e55d..ef04166 100644
--- a/docs/themes.md
+++ b/docs/themes.md
@@ -148,6 +148,16 @@ the content, text and icons keep their own opacity. Its sidebar
and shell menu hovers stay brown so their ivory text remains readable; app
content and toolbar hovers use champagne.
+Settings' Appearance labels and slider readouts use `app_text_size`, its
+uppercase headings use `app_heading_size`, and explanatory text uses
+`settings_description_size` (default 12). Card titles throughout Settings use
+`settings_title_size` (default 17). `settings_card_radius` also applies to the
+Bluetooth and Users cards. All these values reload with the theme.
+`status_connected` sets Bluetooth's connected indicator (default
+`rgba(51,219.3,114.75,1)`). `display_tile_border` sets the unselected screen
+outline in the display arrangement preview (default `rgba(255,255,255,0.16)`);
+selected screens keep the palette's accent outline.
+
`dock_bg` and `dock_border` override the taskbar-derived dock colours;
`dock_radius` is in logical pixels (zero follows the window frame radius);
Appearance's **Dock corner radius** slider sets it.
diff --git a/docs/wiki/Theme.md b/docs/wiki/Theme.md
index 0573a6d..d0a400e 100644
--- a/docs/wiki/Theme.md
+++ b/docs/wiki/Theme.md
@@ -149,6 +149,8 @@ geometry retain their content or structural dimensions.
| `app_nav_selected` | `"rgba(91,36,46,1)"` |
| `app_divider` | `"rgba(55,63,72,1)"` |
| `app_icon` | `"rgba(214,214,214,1)"` |
+| `status_connected` | `"rgba(51,219.3,114.75,1)"` |
+| `display_tile_border` | `"rgba(255,255,255,0.16)"` |
| `scrollbar_thumb` | `"rgba(89,98,110,1)"` |
| `scrollbar_thumb_active` | `unset` |
| `scrollbar_glow` | `1.0` (strength of the thumb's light) |
@@ -313,6 +315,8 @@ Numeric tokens accept 0–4096 unless constrained below. Fractions ending in
| `settings_radius` | `8` |
| `settings_sidebar_radius` | `10` |
| `settings_card_radius` | `9` |
+| `settings_title_size` | `17` |
+| `settings_description_size` | `12` |
| `checkbox_radius` | `4` |
| `toggle_radius` | `5` |
| `toggle_thumb_radius` | `4` |
diff --git a/src/control_center/panel.zig b/src/control_center/panel.zig
index 0c240cd..c634e29 100644
--- a/src/control_center/panel.zig
+++ b/src/control_center/panel.zig
@@ -83,7 +83,8 @@ fn label(value: []const u8, size: f32, dim: bool) Widget {
/// A card or group title: larger and bolder than the semibold row labels.
pub fn sectionTitle(value: []const u8) Widget {
- return .{ .kind = .{ .text = .{ .content = value, .font_size = 17, .weight = 700, .color = palette().fg } } };
+ const t = palette();
+ return .{ .kind = .{ .text = .{ .content = value, .font_size = t.settings_title_size, .weight = 700, .color = t.fg } } };
}
/// Stands in for a section whose widget tree could not be allocated; it
diff --git a/src/control_center/sections/appearance.zig b/src/control_center/sections/appearance.zig
index 087affa..38070b7 100644
--- a/src/control_center/sections/appearance.zig
+++ b/src/control_center/sections/appearance.zig
@@ -298,22 +298,22 @@ fn indexOfNearest(values: []const f32, v: f32) usize {
fn labelWidget(content: []const u8) Widget {
const t = panel.palette();
- return .{ .kind = .{ .text = .{ .content = content, .font_size = 13, .weight = 600, .color = t.fg } } };
+ return .{ .kind = .{ .text = .{ .content = content, .font_size = theme.global.app_text_size, .weight = 600, .color = t.fg } } };
}
fn valueWidget(content: []const u8) Widget {
const t = panel.palette();
- return .{ .kind = .{ .text = .{ .content = content, .font_size = 13, .color = t.dim } } };
+ return .{ .kind = .{ .text = .{ .content = content, .font_size = theme.global.app_text_size, .color = t.dim } } };
}
/// The readout beside a slider, in a rounded label.
fn pillWidget(content: []const u8) Widget {
- return ui_slider.valuePill(content, 13, panel.palette().dim);
+ return ui_slider.valuePill(content, theme.global.app_text_size, panel.palette().dim);
}
fn sectionLabel(content: []const u8) Widget {
const t = panel.palette();
- return .{ .kind = .{ .text = .{ .content = content, .font_size = 12, .weight = 700, .color = t.dim } } };
+ return .{ .kind = .{ .text = .{ .content = content, .font_size = theme.global.app_heading_size, .weight = 700, .color = t.dim } } };
}
/// Builds one "label ... value / slider" pixel-value row and formats its
@@ -440,8 +440,8 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
};
const dark_mode = out.cc.server.config.compositor.dark_mode;
out.dark_label_children = .{
- .{ .kind = .{ .text = .{ .content = "Dark mode", .font_size = 13, .weight = 600, .color = pal.fg } } },
- .{ .kind = .{ .text = .{ .content = "Apps and web pages", .font_size = 12, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = "Dark mode", .font_size = theme.global.app_text_size, .weight = 600, .color = pal.fg } } },
+ .{ .kind = .{ .text = .{ .content = "Apps and web pages", .font_size = theme.global.settings_description_size, .color = pal.dim } } },
};
out.dark_row_children = .{
// Flex like the other rows' text labels: an auto-width column is only
@@ -452,8 +452,8 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
const splash_on = out.cc.server.config.compositor.placeholder_delay_ms > 0;
out.splash_label_children = .{
- .{ .kind = .{ .text = .{ .content = "Show launch splash", .font_size = 13, .weight = 600, .color = pal.fg } } },
- .{ .kind = .{ .text = .{ .content = "Brief placeholder while apps start", .font_size = 12, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = "Show launch splash", .font_size = theme.global.app_text_size, .weight = 600, .color = pal.fg } } },
+ .{ .kind = .{ .text = .{ .content = "Brief placeholder while apps start", .font_size = theme.global.settings_description_size, .color = pal.dim } } },
};
out.splash_row_children = .{
.{ .kind = .container, .direction = .column, .gap = 2, .width = .{ .flex = 1 }, .children = &out.splash_label_children },
@@ -462,8 +462,8 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
const dodge_on = out.cc.server.config.compositor.dodge_file_drags;
out.dodge_label_children = .{
- .{ .kind = .{ .text = .{ .content = "Move file manager aside", .font_size = 13, .weight = 600, .color = pal.fg } } },
- .{ .kind = .{ .text = .{ .content = "While dragging a file out of it", .font_size = 12, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = "Move file manager aside", .font_size = theme.global.app_text_size, .weight = 600, .color = pal.fg } } },
+ .{ .kind = .{ .text = .{ .content = "While dragging a file out of it", .font_size = theme.global.settings_description_size, .color = pal.dim } } },
};
out.dodge_row_children = .{
.{ .kind = .container, .direction = .column, .gap = 2, .width = .{ .flex = 1 }, .children = &out.dodge_label_children },
@@ -471,8 +471,8 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
};
out.dim_label_children = .{
- .{ .kind = .{ .text = .{ .content = "Dim inactive windows", .font_size = 13, .weight = 600, .color = pal.fg } } },
- .{ .kind = .{ .text = .{ .content = "Slightly darken and mute windows that are not focused", .font_size = 12, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = "Dim inactive windows", .font_size = theme.global.app_text_size, .weight = 600, .color = pal.fg } } },
+ .{ .kind = .{ .text = .{ .content = "Slightly darken and mute windows that are not focused", .font_size = theme.global.settings_description_size, .color = pal.dim } } },
};
out.dim_row_children = .{
.{ .kind = .container, .direction = .column, .gap = 2, .width = .{ .flex = 1 }, .children = &out.dim_label_children },
@@ -481,8 +481,8 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
const anim_enabled = out.cc.server.config.animations.enabled;
out.anim_enabled_label_children = .{
- .{ .kind = .{ .text = .{ .content = "Animations", .font_size = 13, .weight = 600, .color = pal.fg } } },
- .{ .kind = .{ .text = .{ .content = "Window and panel transitions", .font_size = 12, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = "Animations", .font_size = theme.global.app_text_size, .weight = 600, .color = pal.fg } } },
+ .{ .kind = .{ .text = .{ .content = "Window and panel transitions", .font_size = theme.global.settings_description_size, .color = pal.dim } } },
};
out.anim_enabled_row_children = .{
.{ .kind = .container, .direction = .column, .gap = 2, .width = .{ .flex = 1 }, .children = &out.anim_enabled_label_children },
@@ -513,7 +513,7 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
out.focus_zoom_children = .{
labelWidget("Window switching zoom"),
.{ .name = "focus_zoom", .kind = .{ .segmented = .{ .labels = &focus_zoom_labels, .selected = @intFromEnum(focus_zoom), .owner = out, .on_change = &onFocusZoomChanged } }, .width = .{ .percent = 1 } },
- .{ .kind = .{ .text = .{ .content = focus_zoom_descriptions[@intFromEnum(focus_zoom)], .font_size = 12, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = focus_zoom_descriptions[@intFromEnum(focus_zoom)], .font_size = theme.global.settings_description_size, .color = pal.dim } } },
};
out.drag_feedback_children = .{
@@ -612,8 +612,8 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
};
out.glow_label_children = .{
- .{ .kind = .{ .text = .{ .content = "Edge glow", .font_size = 13, .weight = 600, .color = pal.fg } } },
- .{ .kind = .{ .text = .{ .content = "Light the active window's edge near the pointer", .font_size = 12, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = "Edge glow", .font_size = theme.global.app_text_size, .weight = 600, .color = pal.fg } } },
+ .{ .kind = .{ .text = .{ .content = "Light the active window's edge near the pointer", .font_size = theme.global.settings_description_size, .color = pal.dim } } },
};
out.glow_row_children = .{
.{ .kind = .container, .direction = .column, .gap = 2, .width = .{ .flex = 1 }, .children = &out.glow_label_children },
@@ -738,7 +738,7 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
inline for (0..taskbar_items.count) |i| {
out.item_controls[i] = .{
.{ .kind = .{ .button = .{ .label = "Drag to move", .icon = .drag_handle, .variant = .ghost, .owner = out, .id = i } }, .width = .{ .fixed = 28 }, .height = .{ .fixed = 28 } },
- .{ .kind = .{ .text = .{ .content = "", .font_size = 13, .weight = 600, .color = pal.fg } }, .width = .{ .flex = 1 } },
+ .{ .kind = .{ .text = .{ .content = "", .font_size = theme.global.app_text_size, .weight = 600, .color = pal.fg } }, .width = .{ .flex = 1 } },
.{ .kind = .{ .toggle = .{ .on = false, .owner = out, .on_change = &ItemToggle(i).changed } } },
};
out.item_rows[i] = .{ .kind = .{ .rect = itemRowStyle(false) }, .direction = .row, .gap = 8, .@"align" = .center, .padding = .{ .top = 6, .right = 10, .bottom = 6, .left = 6 }, .children = &out.item_controls[i] };
@@ -747,7 +747,7 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
out.items_placeholder_body[zone] = .{
.{ .kind = .container, .width = .{ .flex = 1 } },
// Slack: a fractional raster scale hints wider than the logical measure.
- .{ .kind = .{ .text = .{ .content = "Drag items here", .font_size = 12, .color = pal.dim } }, .min_width = @import("ui").measure.textNatural("Drag items here", .sans, 400, 12).w + 6 },
+ .{ .kind = .{ .text = .{ .content = "Drag items here", .font_size = theme.global.settings_description_size, .color = pal.dim } }, .min_width = @import("ui").measure.textNatural("Drag items here", .sans, 400, theme.global.settings_description_size).w + 6 },
.{ .kind = .container, .width = .{ .flex = 1 } },
};
out.items_placeholder[zone] = .{.{ .kind = .container, .height = .{ .fixed = item_row_height }, .@"align" = .center, .children = &out.items_placeholder_body[zone] }};
@@ -759,14 +759,14 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
_ = syncItems(out, out.cc.server.config.compositor.taskbar_items, null);
out.items_children = .{
labelWidget("Taskbar sections"),
- .{ .kind = .{ .text = .{ .content = "Drag an item to reorder it or move it to another section. Switch it off to hide it. Battery appears when available.", .font_size = 12, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = "Drag an item to reorder it or move it to another section. Switch it off to hide it. Battery appears when available.", .font_size = theme.global.settings_description_size, .color = pal.dim } } },
.{ .kind = .container, .direction = .column, .gap = 6, .@"align" = .stretch, .children = &out.items_section_children[0] },
.{ .kind = .container, .direction = .column, .gap = 6, .@"align" = .stretch, .children = &out.items_section_children[1] },
.{ .kind = .container, .direction = .column, .gap = 6, .@"align" = .stretch, .children = &out.items_section_children[2] },
.{ .name = "taskbar_capture_notice", .kind = .{ .text = .{ .content = if (out.cc.server.config.compositor.taskbar_items.shown(.capture))
"Screen capture appears while recording or sharing your screen. Keeping it enabled is recommended."
else
- "Warning: Screen capture is hidden. Recording and screen sharing can continue without a visible indicator or Stop sharing button. Hiding it is not recommended.", .font_size = 12, .color = pal.dim } } },
+ "Warning: Screen capture is hidden. Recording and screen sharing can continue without a visible indicator or Stop sharing button. Hiding it is not recommended.", .font_size = theme.global.settings_description_size, .color = pal.dim } } },
};
const items_group: Widget = .{ .kind = .container, .direction = .column, .gap = 8, .@"align" = .stretch, .children = &out.items_children };
out.taskbar_section_children = .{ panel.sectionTitle("Taskbar"), position_row, taskbar_row, edge_gap_row, length_row, radius_row, chip_width_row, chip_gap_row, start_gap_row, start_icon_row, clock_bold_row, clock_italic_row, items_group };
@@ -805,7 +805,7 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
.height = .{ .fixed = @floatFromInt(logo.size) },
}};
out.start_logo_info = .{
- .{ .name = "start_logo_file", .kind = .{ .text = .{ .content = logo_note, .font_size = 12, .color = pal.dim } } },
+ .{ .name = "start_logo_file", .kind = .{ .text = .{ .content = logo_note, .font_size = theme.global.settings_description_size, .color = pal.dim } } },
.{ .kind = .container, .direction = .row, .gap = 8, .children = &out.start_logo_buttons },
};
out.start_logo_body = .{
@@ -826,7 +826,7 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
};
const logo_row: Widget = .{ .kind = .container, .direction = .column, .gap = 8, .children = &out.start_logo_children };
out.start_size_children = .{
- .{ .name = "start_menu_size_note", .kind = .{ .text = .{ .content = if (menu_pinned) "Custom size" else "Sized to fit your screen · move a slider to set your own", .font_size = 12, .color = pal.dim } }, .width = .{ .flex = 1 } },
+ .{ .name = "start_menu_size_note", .kind = .{ .text = .{ .content = if (menu_pinned) "Custom size" else "Sized to fit your screen · move a slider to set your own", .font_size = theme.global.settings_description_size, .color = pal.dim } }, .width = .{ .flex = 1 } },
.{ .name = "start_menu_size_auto", .kind = .{ .button = .{ .label = "Size to screen", .owner = out, .on_click = &onAutoMenuSize, .state = if (menu_pinned) .idle else .disabled } }, .width = .{ .fixed = 124 }, .height = .{ .fixed = 30 } },
};
const menu_size_row: Widget = .{ .kind = .container, .direction = .row, .gap = 8, .@"align" = .center, .children = &out.start_size_children };
@@ -965,7 +965,7 @@ pub fn build(out: *Section, cc: *panel.ControlCenter) void {
card.* = if (group.title == null) out.group_storage[start] else .{ .kind = .container, .direction = .column, .gap = 16, .children = out.group_storage[start..at] };
}
out.top_children = .{
- .{ .kind = .{ .text = .{ .content = "APPEARANCE", .font_size = 12, .weight = 700, .color = pal.dim } } },
+ .{ .kind = .{ .text = .{ .content = "APPEARANCE", .font_size = theme.global.app_heading_size, .weight = 700, .color = pal.dim } } },
.{ .kind = .container, .direction = .column, .gap = 12, .children = &out.group_cards },
};
out.root = .{ .kind = .container, .direction = .column, .gap = 8, .children = &out.top_children };
@@ -1083,14 +1083,14 @@ fn appColorsNote(s: *Section, a: std.mem.Allocator, color: [4]f32) Widget {
var end: usize = 0;
while (words.next()) |word| {
const next = @intFromPtr(word.ptr) - @intFromPtr(s.app_colors_message.ptr) + word.len;
- const measured = text.measureWidthF(s.app_colors_message[start..next], .manrope, 12, 1) catch 0;
+ const measured = text.measureWidthF(s.app_colors_message[start..next], .manrope, theme.global.settings_description_size, 1) catch 0;
if (end > start and measured > width) {
- lines.append(a, .{ .name = std.fmt.allocPrint(a, "app_colors_status_{d}", .{lines.items.len}) catch "app_colors_status_line", .kind = .{ .text = .{ .content = s.app_colors_message[start..end], .font_size = 12, .color = color } } }) catch break;
+ lines.append(a, .{ .name = std.fmt.allocPrint(a, "app_colors_status_{d}", .{lines.items.len}) catch "app_colors_status_line", .kind = .{ .text = .{ .content = s.app_colors_message[start..end], .font_size = theme.global.settings_description_size, .color = color } } }) catch break;
start = next - word.len;
}
end = next;
}
- if (end > start) lines.append(a, .{ .name = std.fmt.allocPrint(a, "app_colors_status_{d}", .{lines.items.len}) catch "app_colors_status_line", .kind = .{ .text = .{ .content = s.app_colors_message[start..end], .font_size = 12, .color = color } } }) catch {};
+ if (end > start) lines.append(a, .{ .name = std.fmt.allocPrint(a, "app_colors_status_{d}", .{lines.items.len}) catch "app_colors_status_line", .kind = .{ .text = .{ .content = s.app_colors_message[start..end], .font_size = theme.global.settings_description_size, .color = color } } }) catch {};
return .{ .name = "app_colors_status", .kind = .container, .direction = .column, .gap = 2, .children = lines.toOwnedSlice(a) catch &.{} };
}
@@ -1258,7 +1258,7 @@ fn buildWallpaper(out: *Section, arena: std.mem.Allocator) void {
else
std.fmt.allocPrint(arena, "Add your own images to {s}", .{tildePath(arena, dir)}) catch "Add your own images";
out.wallpaper_footer_children = .{
- .{ .kind = .{ .text = .{ .content = hint, .font_size = 12, .color = pal.dim } }, .width = .{ .flex = 1 } },
+ .{ .kind = .{ .text = .{ .content = hint, .font_size = theme.global.settings_description_size, .color = pal.dim } }, .width = .{ .flex = 1 } },
.{
.name = "wallpaper_folder",
.kind = .{ .button = .{ .label = "Choose folder", .owner = out, .on_click = &onChooseWallpaperFolder, .state = if (folder_picker.running()) .disabled else .idle } },
@@ -1276,7 +1276,7 @@ fn buildStrip(out: *Section, arena: std.mem.Allocator, pal: theme.Theme, current
const n = out.strip_entries.len;
if (n == 0) {
const note = arena.alloc(Widget, 1) catch return .{ .kind = .container };
- note[0] = .{ .kind = .{ .text = .{ .content = "No images in this folder", .font_size = 12, .color = pal.dim } } };
+ note[0] = .{ .kind = .{ .text = .{ .content = "No images in this folder", .font_size = theme.global.settings_description_size, .color = pal.dim } } };
return .{ .name = "wallpaper_strip_empty", .kind = .container, .direction = .row, .children = note };
}
const tiles = arena.alloc(Widget, n) catch return .{ .kind = .container };
diff --git a/src/control_center/sections/bluetooth.zig b/src/control_center/sections/bluetooth.zig
index 310a94d..20135f2 100644
--- a/src/control_center/sections/bluetooth.zig
+++ b/src/control_center/sections/bluetooth.zig
@@ -63,7 +63,7 @@ fn group(a: A, dir: ui.layout.Direction, items: []const W) !W {
fn card(a: A, items: []const W) !W {
var w = try group(a, .column, items);
const t = panel.palette();
- w.kind = .{ .rect = .{ .color = t.app_item, .radius = 9, .border_width = 1, .border_color = t.app_item_border } };
+ w.kind = .{ .rect = .{ .color = t.app_item, .radius = t.settings_card_radius, .border_width = 1, .border_color = t.app_item_border } };
w.padding = ui.layout.Edges.all(14);
w.gap = 14;
return w;
@@ -83,8 +83,9 @@ fn glyph(d: *const bt.Device) ui.layout.IconId {
return .bluetooth;
}
fn status(a: A, value: []const u8, connected: bool) !W {
+ const t = panel.palette();
return group(a, .row, &.{
- .{ .kind = .{ .rect = .{ .color = if (connected) .{ 0.2, 0.86, 0.45, 1 } else panel.palette().dim, .radius = 4 } }, .width = .{ .fixed = 7 }, .height = .{ .fixed = 7 } }, text(value, 13, true),
+ .{ .kind = .{ .rect = .{ .color = if (connected) t.status_connected else t.dim, .radius = 4 } }, .width = .{ .fixed = 7 }, .height = .{ .fixed = 7 } }, text(value, 13, true),
});
}
fn currentAdapter(s: *Section, m: *bt.Manager) ?*const bt.Adapter {
diff --git a/src/control_center/sections/users.zig b/src/control_center/sections/users.zig
index 1071d8e..c1fb627 100644
--- a/src/control_center/sections/users.zig
+++ b/src/control_center/sections/users.zig
@@ -69,7 +69,8 @@ fn text(value: []const u8, size: f32, dim: bool) W {
}
fn buildCard(a: std.mem.Allocator, children: []const W) !W {
- return .{ .kind = .{ .rect = .{ .color = ui.theme.global.app_item, .radius = 9, .border_width = 1, .border_color = ui.theme.global.app_item_border } }, .direction = .column, .padding = ui.layout.Edges.all(14), .gap = 9, .width = .{ .percent = 1 }, .children = try a.dupe(W, children) };
+ const t = panel.palette();
+ return .{ .kind = .{ .rect = .{ .color = t.app_item, .radius = t.settings_card_radius, .border_width = 1, .border_color = t.app_item_border } }, .direction = .column, .padding = ui.layout.Edges.all(14), .gap = 9, .width = .{ .percent = 1 }, .children = try a.dupe(W, children) };
}
pub fn build(s: *Section, cc: *panel.ControlCenter) void {
diff --git a/src/ui/theme.zig b/src/ui/theme.zig
index c6c97cb..e9c47fc 100644
--- a/src/ui/theme.zig
+++ b/src/ui/theme.zig
@@ -307,6 +307,13 @@ pub const Theme = struct {
settings_radius: f32 = 8,
settings_sidebar_radius: f32 = 10,
settings_card_radius: f32 = 9,
+ /// Settings section titles and explanatory text; row labels use app_text_size.
+ settings_title_size: f32 = 17,
+ settings_description_size: f32 = 12,
+ /// Bluetooth's connected indicator, independent of the accent palette.
+ status_connected: [4]f32 = .{ 0.2, 0.86, 0.45, 1 },
+ /// Outline of an unselected screen in the display arrangement preview.
+ display_tile_border: [4]f32 = .{ 1, 1, 1, 0.16 },
checkbox_radius: f32 = 4,
toggle_radius: f32 = 5,
toggle_thumb_radius: f32 = 4,
diff --git a/src/ui/widgets/arrangement.zig b/src/ui/widgets/arrangement.zig
index 738eccd..1e8ab9c 100644
--- a/src/ui/widgets/arrangement.zig
+++ b/src/ui/widgets/arrangement.zig
@@ -240,7 +240,7 @@ fn paintTile(r: *Renderer, t: theme.Theme, box: Rect, item: Item, selected: bool
.color = if (selected) t.app_item_selected else t.app_item_hover,
.radius = radius,
.border_width = if (selected) 2 else 1,
- .border_color = if (selected) t.accent else if (lifted) t.window_border_hover else .{ 1, 1, 1, 0.16 },
+ .border_color = if (selected) t.accent else if (lifted) t.window_border_hover else t.display_tile_border,
});
if (item.primary and box.h > 24) {
// A menu bar along the top marks the main display.
@@ -284,6 +284,18 @@ fn testItems() [2]Item {
};
}
+test "display tile borders follow the theme and keep the selection accent" {
+ var pixels: [40 * 40]u32 = @splat(0);
+ var renderer = Renderer.init(&pixels, 40, 40, 1);
+ const t = theme.Theme{ .display_tile_border = .{ 0, 1, 0, 1 }, .accent = .{ 1, 0, 0, 1 } };
+ const box = Rect{ .x = 4, .y = 4, .w = 32, .h = 32 };
+ const item = Item{ .x = 0, .y = 0, .width = 32, .height = 32, .label = "" };
+ paintTile(&renderer, t, box, item, false, false);
+ try std.testing.expectEqual(@as(u32, 0xff00ff00), pixels[20 * 40 + 4]);
+ paintTile(&renderer, t, box, item, true, false);
+ try std.testing.expectEqual(@as(u32, 0xffff0000), pixels[20 * 40 + 4]);
+}
+
test "snap keeps a dragged screen against its neighbour without overlap" {
var items = testItems();
// Dragged into A: pushed back out to the nearest free edge.
diff --git a/tests/appearance_fonts.py b/tests/appearance_fonts.py
index 68efa1a..2b57472 100644
--- a/tests/appearance_fonts.py
+++ b/tests/appearance_fonts.py
@@ -113,6 +113,22 @@ def run(external_theme):
return header, chrome
appearance()
+ # Appearance's labels, descriptions and card titles must use
+ # their theme sizes, including after a live reload.
+ size_labels = ("UI font", "Apps and web pages", "Themes & colours")
+ def text_heights():
+ return tuple(next(w for w in widgets() if w.get("label") == label)["box"]["height"]
+ for label in size_labels)
+ original_theme = theme_path.read_text()
+ original_heights = text_heights()
+ theme_path.write_text(original_theme + '\napp_text_size = 19\nsettings_description_size = 18\nsettings_title_size = 24\n')
+ ipc.reload_config()
+ ipc.wait_for_panel_settled("control_center")
+ assert all(after > before for before, after in zip(original_heights, text_heights())), (original_heights, text_heights())
+ theme_path.write_text(original_theme)
+ ipc.reload_config()
+ ipc.wait_for_panel_settled("control_center")
+ assert text_heights() == original_heights
before, settings_chrome = capture_header("before")
assert not font_select()["is_disabled"]
click(font_select())
diff --git a/tests/bluetooth.py b/tests/bluetooth.py
index 4b52e5e..d7a4386 100644
--- a/tests/bluetooth.py
+++ b/tests/bluetooth.py
@@ -148,6 +148,20 @@ def run(scale):
choose('WH-1000XM5')
wait_label('Audio (A2DP) · High quality audio')
assert find('bluetooth_battery')['role']=='battery'
+ # The connected indicator follows TOML across a live reload.
+ config_path = tmp / 'rediwm-config.toml'
+ original_config = config_path.read_text()
+ for color in ('#12df47', '#df127a'):
+ config_path.write_text(original_config + '\n[theme]\nstatus_connected = "' + color + '"\nsettings_card_radius = 24\n')
+ ipc.reload_config();ui.wait_settled('control_center')
+ path = tmp / ('status-color-' + color[1:] + '.png')
+ ipc.screenshot(str(path))
+ wanted = tuple(int(color[i:i+2], 16) for i in (1, 3, 5))
+ with Image.open(path) as image:
+ colors = image.convert('RGB').getcolors(image.width * image.height)
+ assert sum(n for n, value in colors if value == wanted) >= 10, color
+ config_path.write_text(original_config)
+ ipc.reload_config();ui.wait_settled('control_center')
capture('bluetooth')
click('bluetooth_connect');wait_for(lambda:not state()['connected'],'disconnect')
click('bluetooth_connect');wait_for(lambda:state()['connected'],'connect')