Skip to content

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

Gold theme and icons

oxydizerf85ff2a431e0
diff --git a/AGENTS.md b/AGENTS.md
index 5390083..2c7d42f 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -238,9 +238,11 @@ the one for the directory you work in: `src/files`, `src/editor`,
hand-hit-test one (`src/ui/AGENTS.md`).
* App clients (Files, Images, PDF) draw through `ui/cairo.zig` with theme
tokens (`app_*`, `shellPalette().accent`) and shell icons. Text is
- `window_fg` only (placeholder at half alpha) at `text_size`,
+ the effective `window_fg` (placeholder at half alpha) at `text_size`,
`heading_size` or `status_size`, never hardcoded sizes. Load the theme with
`files/settings.zig` before the first frame (PDF: before its sandbox).
+ That loader resolves `Theme.forApp()` so `app_fg`, menu and field overrides
+ can differ from compositor chrome; sidebar text uses `sidebarForeground()`.
* Secrets live in `secret_input.Input` over caller-owned mlocked storage;
hand-laid secret fields draw the caret with `CaretOverlay`.
* **Dead keys:** `xkb_state_key_get_utf8` returns nothing for them, so any
diff --git a/assets/themes/gold.toml b/assets/themes/gold.toml
new file mode 100644
index 0000000..5c162cb
--- /dev/null
+++ b/assets/themes/gold.toml
@@ -0,0 +1,185 @@
+[meta]
+format = 1
+id = "gold"
+name = "Gold"
+version = "1.0"
+description = "Champagne accents, warm charcoal glass and ivory app surfaces."
+
+# App foregrounds are independent of the dark window chrome and sidebar.
+[theme]
+font = "Manrope"
+mono_font = "JetBrains Mono"
+font_size = 13
+radius = 7
+radius_md = 10
+radius_lg = 16
+title_size = 13.5
+chrome_height = 40
+chrome_control_gap = 8
+taskbar_title_size = 12.5
+taskbar_size = 38
+start_button_icon_size = 29
+chip_gap = 4
+chip_width = 220
+start_button_gap = 4
+button_font_size = 12.5
+caret_width = 1.5
+field_radius = 9
+shadow_size = 28
+shadow_offset_y = 7
+start_menu_radius = 18
+start_menu_left_pad = 2
+start_menu_bottom_pad = 6
+start_menu_icon_left_pad = 12
+start_menu_icon_bottom_pad = 6
+window_bg = "rgba(48,43,42,0.91)"
+window_fg = "#F4ECE1"
+window_dim = "#D7CBBE"
+window_border = "rgba(226,184,134,0.70)"
+window_border_hover = "rgba(255,211,151,0.94)"
+window_divider = "rgba(236,208,170,0.18)"
+window_close_hover = "#AD5A4A"
+text_secondary = "#6D6257"
+app_bg = "#EEE6DB"
+app_toolbar = "#E8DFD2"
+app_sidebar = "#443D3A"
+app_bar = "#E8DED1"
+app_item = "#F3ECE2"
+app_item_hover = "#E5D6C3"
+app_item_border = "#CBBDA9"
+app_item_selected = "#E6C7A8"
+app_nav_selected = "#E6C7A8"
+app_sidebar_selected = "#745C48"
+app_divider = "#CFC2B2"
+app_icon = "#E4D8C8"
+scrollbar_thumb = "#AC9377"
+scrollbar_thumb_active = "#B88048"
+bg = "#292423"
+fg = "#F4ECE1"
+dim = "#D7CBBE"
+faint = "#B6A99B"
+accent = "#D5A16A"
+accent_2 = "#DCC3A2"
+accent_3 = "#B98662"
+danger = "#D87565"
+on_accent = "#30251C"
+shell_accent = "#D5A16A"
+shell_on_accent = "#30251C"
+surface = "rgba(239,218,190,0.08)"
+surface_hover = "rgba(239,218,190,0.14)"
+border = "rgba(231,202,166,0.32)"
+border_soft = "rgba(231,202,166,0.16)"
+border_hover = "rgba(246,213,171,0.56)"
+border_focus = "rgba(224,181,131,0.70)"
+glass = "rgba(58,49,43,0.68)"
+glass_strong = "rgba(58,49,43,0.85)"
+shadow = "rgba(12,8,7,0.38)"
+border_glow = "rgba(255,204,141,0.68)"
+taskbar_bg = "rgba(43,39,39,0.93)"
+taskbar_surface = "rgba(247,229,204,0.035)"
+taskbar_hover = "rgba(247,229,204,0.09)"
+taskbar_border = "rgba(230,204,170,0.32)"
+start_menu_bg = "rgba(48,42,38,0.94)"
+start_menu_border = "rgba(237,207,165,0.46)"
+start_menu_search_bg = "#39312B"
+start_menu_selected_bg = "rgba(219,170,113,0.16)"
+start_menu_selected_border = "rgba(237,197,146,0.44)"
+start_menu_selected_marker = "#DFAC74"
+field_bg = "#39312B"
+field_border = "#74604D"
+selection_alpha = 0.25
+toggle_track = "rgba(227,209,185,0.22)"
+slider_track = "rgba(0,0,0,0.32)"
+pill_bg = "rgba(234,207,174,0.08)"
+settings_card_bg = "rgba(241,218,188,0.055)"
+calendar_border = "rgba(237,207,165,0.48)"
+osd_border = "rgba(237,207,165,0.48)"
+start_button_hover = "rgba(241,218,188,0.10)"
+start_button_indicator = "#E8C599"
+switcher_border = "#B68D63"
+switcher_selected_border = "#E5B780"
+screenshot_border = "#D5A16A"
+desktop_selected = "rgba(218,169,110,0.20)"
+desktop_selection = "rgba(218,169,110,0.18)"
+desktop_selection_border = "#DCAC73"
+desktop_drop_border = "#DCAC73"
+start_button_logo_color = "#E6C79E"
+file_broken = "#B34E3C"
+battery_critical = "#168579"
+desktop_notice_bg = "#513A2E"
+window_close_fg = "#FFF5E7"
+app_fg = "#39332E"
+app_sidebar_fg = "#F1E7DB"
+app_menu_bg = "#EEE6DB"
+app_field_bg = "#E0D5C5"
+app_field_border = "#C8B59F"
+shell_border_focus = "#E0B583"
+border_glow_depth = 3
+border_glow_length = 80
+border_glow_reach = 56
+workspace_active_border = "#DDB282"
+dock_bg = "rgba(56,49,46,0.80)"
+dock_border = "rgba(237,210,176,0.58)"
+dock_radius = 22
+notification_bg = "rgba(74,63,54,0.80)"
+notification_fg = "#FBF2E7"
+notification_dim = "#E2D3C1"
+notification_border = "rgba(239,215,184,0.65)"
+notification_icon_bg = "rgba(247,231,208,0.18)"
+notification_radius = 18
+notification_blur = true
+control_thumb = "#FFF0DA"
+slider_thumb_radius = 10
+slider_thumb_size = 14
+toggle_radius = 12
+toggle_thumb_radius = 10
+settings_card_radius = 12
+switcher_bg = "#292423"
+switcher_item_bg = "#3D3530"
+switcher_item_border = "#79614C"
+switcher_fg = "#F4ECE1"
+switcher_dim = "#C8B6A1"
+switcher_icon_bg = "#473B32"
+desktop_dialog_bg = "#332C27"
+desktop_fg = "#F3E7D7"
+desktop_icon_start = "#E3C6A0"
+desktop_icon_end = "#A87546"
+file_folder_back = "#A87546"
+file_folder_front = "#E5CDB0"
+file_document = "#D6B78F"
+file_document_lines = "#6F5842"
+lock_bg = "#241E1C"
+lock_fg = "#F6EADB"
+lock_dim = "#CAB8A2"
+lock_divider = "#74604C"
+lock_session_fg = "#E4CFB5"
+image_checker_dark = "#C1B6A7"
+image_checker_light = "#DDD4C6"
+terminal_bg = "#211F20"
+terminal_fg = "#E8D3B0"
+terminal_cursor = "#F2CCA0"
+terminal_black = "#302C29"
+terminal_red = "#D57D6F"
+terminal_green = "#A5B980"
+terminal_yellow = "#DDB477"
+terminal_blue = "#8CA8BF"
+terminal_magenta = "#BC97AE"
+terminal_cyan = "#92B9AC"
+terminal_white = "#E8D3B0"
+terminal_bright_black = "#8D7C69"
+terminal_bright_red = "#ED9A87"
+terminal_bright_green = "#BED59B"
+terminal_bright_yellow = "#F2CCA0"
+terminal_bright_blue = "#ADC4D8"
+terminal_bright_magenta = "#D6B3C6"
+terminal_bright_cyan = "#B1D3C5"
+terminal_bright_white = "#FFF0DA"
+
+[layout]
+taskbar_position = "top"
+dock_enabled = true
+dock_height = 76
+
+[assets]
+color_scheme = "light"
+wallpaper = "wallpaper-gold.png"
diff --git a/assets/themes/gold/README b/assets/themes/gold/README
new file mode 100644
index 0000000..bc1ecba
--- /dev/null
+++ b/assets/themes/gold/README
@@ -0,0 +1,8 @@
+Gold
+
+Colour artwork comes from assets/icons/gold/ in the RediWM source tree.
+Runtime copies are bounded to 256 pixels and use freedesktop icon names.
+The source artwork is retained unchanged. The preview is a compositor capture.
+
+The theme also provides taskbar/dock layout defaults and a Foot launch palette.
+See docs/themes.md in the source tree for the theme format and override rules.
diff --git a/assets/themes/gold/icons/Alacritty.png b/assets/themes/gold/icons/Alacritty.png
new file mode 100644
index 0000000..697c762
Binary files /dev/null and b/assets/themes/gold/icons/Alacritty.png differ
diff --git a/assets/themes/gold/icons/accessories-text-editor.png b/assets/themes/gold/icons/accessories-text-editor.png
new file mode 100644
index 0000000..9c25307
Binary files /dev/null and b/assets/themes/gold/icons/accessories-text-editor.png differ
diff --git a/assets/themes/gold/icons/app.zen_browser.zen.png b/assets/themes/gold/icons/app.zen_browser.zen.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/app.zen_browser.zen.png differ
diff --git a/assets/themes/gold/icons/application-octet-stream.png b/assets/themes/gold/icons/application-octet-stream.png
new file mode 100644
index 0000000..d9d3fcf
Binary files /dev/null and b/assets/themes/gold/icons/application-octet-stream.png differ
diff --git a/assets/themes/gold/icons/brave-desktop.png b/assets/themes/gold/icons/brave-desktop.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/brave-desktop.png differ
diff --git a/assets/themes/gold/icons/chromium-browser.png b/assets/themes/gold/icons/chromium-browser.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/chromium-browser.png differ
diff --git a/assets/themes/gold/icons/chromium.png b/assets/themes/gold/icons/chromium.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/chromium.png differ
diff --git a/assets/themes/gold/icons/com.brave.Browser.png b/assets/themes/gold/icons/com.brave.Browser.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/com.brave.Browser.png differ
diff --git a/assets/themes/gold/icons/firefox-developer-edition.png b/assets/themes/gold/icons/firefox-developer-edition.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/firefox-developer-edition.png differ
diff --git a/assets/themes/gold/icons/firefox.png b/assets/themes/gold/icons/firefox.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/firefox.png differ
diff --git a/assets/themes/gold/icons/folder-documents.png b/assets/themes/gold/icons/folder-documents.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/folder-documents.png differ
diff --git a/assets/themes/gold/icons/folder-download.png b/assets/themes/gold/icons/folder-download.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/folder-download.png differ
diff --git a/assets/themes/gold/icons/folder-music.png b/assets/themes/gold/icons/folder-music.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/folder-music.png differ
diff --git a/assets/themes/gold/icons/folder-pictures.png b/assets/themes/gold/icons/folder-pictures.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/folder-pictures.png differ
diff --git a/assets/themes/gold/icons/folder-publicshare.png b/assets/themes/gold/icons/folder-publicshare.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/folder-publicshare.png differ
diff --git a/assets/themes/gold/icons/folder-templates.png b/assets/themes/gold/icons/folder-templates.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/folder-templates.png differ
diff --git a/assets/themes/gold/icons/folder-videos.png b/assets/themes/gold/icons/folder-videos.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/folder-videos.png differ
diff --git a/assets/themes/gold/icons/folder.png b/assets/themes/gold/icons/folder.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/folder.png differ
diff --git a/assets/themes/gold/icons/foot.png b/assets/themes/gold/icons/foot.png
new file mode 100644
index 0000000..697c762
Binary files /dev/null and b/assets/themes/gold/icons/foot.png differ
diff --git a/assets/themes/gold/icons/footclient.png b/assets/themes/gold/icons/footclient.png
new file mode 100644
index 0000000..697c762
Binary files /dev/null and b/assets/themes/gold/icons/footclient.png differ
diff --git a/assets/themes/gold/icons/google-chrome.png b/assets/themes/gold/icons/google-chrome.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/google-chrome.png differ
diff --git a/assets/themes/gold/icons/kitty.png b/assets/themes/gold/icons/kitty.png
new file mode 100644
index 0000000..697c762
Binary files /dev/null and b/assets/themes/gold/icons/kitty.png differ
diff --git a/assets/themes/gold/icons/org.gnome.Terminal.png b/assets/themes/gold/icons/org.gnome.Terminal.png
new file mode 100644
index 0000000..697c762
Binary files /dev/null and b/assets/themes/gold/icons/org.gnome.Terminal.png differ
diff --git a/assets/themes/gold/icons/org.mozilla.firefox.png b/assets/themes/gold/icons/org.mozilla.firefox.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/org.mozilla.firefox.png differ
diff --git a/assets/themes/gold/icons/preferences-desktop.png b/assets/themes/gold/icons/preferences-desktop.png
new file mode 100644
index 0000000..7b92c6c
Binary files /dev/null and b/assets/themes/gold/icons/preferences-desktop.png differ
diff --git a/assets/themes/gold/icons/preferences-system.png b/assets/themes/gold/icons/preferences-system.png
new file mode 100644
index 0000000..7b92c6c
Binary files /dev/null and b/assets/themes/gold/icons/preferences-system.png differ
diff --git a/assets/themes/gold/icons/redi-fm-icon.png b/assets/themes/gold/icons/redi-fm-icon.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/redi-fm-icon.png differ
diff --git a/assets/themes/gold/icons/rediwm-editor.png b/assets/themes/gold/icons/rediwm-editor.png
new file mode 100644
index 0000000..9c25307
Binary files /dev/null and b/assets/themes/gold/icons/rediwm-editor.png differ
diff --git a/assets/themes/gold/icons/rediwm-files.png b/assets/themes/gold/icons/rediwm-files.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/rediwm-files.png differ
diff --git a/assets/themes/gold/icons/rediwm-settings.png b/assets/themes/gold/icons/rediwm-settings.png
new file mode 100644
index 0000000..7b92c6c
Binary files /dev/null and b/assets/themes/gold/icons/rediwm-settings.png differ
diff --git a/assets/themes/gold/icons/system-file-manager.png b/assets/themes/gold/icons/system-file-manager.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/system-file-manager.png differ
diff --git a/assets/themes/gold/icons/text-plain.png b/assets/themes/gold/icons/text-plain.png
new file mode 100644
index 0000000..9c25307
Binary files /dev/null and b/assets/themes/gold/icons/text-plain.png differ
diff --git a/assets/themes/gold/icons/text-x-generic.png b/assets/themes/gold/icons/text-x-generic.png
new file mode 100644
index 0000000..9c25307
Binary files /dev/null and b/assets/themes/gold/icons/text-x-generic.png differ
diff --git a/assets/themes/gold/icons/unknown.png b/assets/themes/gold/icons/unknown.png
new file mode 100644
index 0000000..d9d3fcf
Binary files /dev/null and b/assets/themes/gold/icons/unknown.png differ
diff --git a/assets/themes/gold/icons/user-desktop.png b/assets/themes/gold/icons/user-desktop.png
new file mode 100644
index 0000000..d27643b
Binary files /dev/null and b/assets/themes/gold/icons/user-desktop.png differ
diff --git a/assets/themes/gold/icons/user-home.png b/assets/themes/gold/icons/user-home.png
new file mode 100644
index 0000000..dcbbf46
Binary files /dev/null and b/assets/themes/gold/icons/user-home.png differ
diff --git a/assets/themes/gold/icons/user-trash-full.png b/assets/themes/gold/icons/user-trash-full.png
new file mode 100644
index 0000000..7c39e3f
Binary files /dev/null and b/assets/themes/gold/icons/user-trash-full.png differ
diff --git a/assets/themes/gold/icons/user-trash.png b/assets/themes/gold/icons/user-trash.png
new file mode 100644
index 0000000..7c39e3f
Binary files /dev/null and b/assets/themes/gold/icons/user-trash.png differ
diff --git a/assets/themes/gold/icons/utilities-terminal.png b/assets/themes/gold/icons/utilities-terminal.png
new file mode 100644
index 0000000..697c762
Binary files /dev/null and b/assets/themes/gold/icons/utilities-terminal.png differ
diff --git a/assets/themes/gold/icons/web-browser.png b/assets/themes/gold/icons/web-browser.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/web-browser.png differ
diff --git a/assets/themes/gold/icons/zen-browser.png b/assets/themes/gold/icons/zen-browser.png
new file mode 100644
index 0000000..46ddb96
Binary files /dev/null and b/assets/themes/gold/icons/zen-browser.png differ
diff --git a/assets/themes/gold/preview.png b/assets/themes/gold/preview.png
new file mode 100644
index 0000000..4772841
Binary files /dev/null and b/assets/themes/gold/preview.png differ
diff --git a/assets/themes/redi-blue.toml b/assets/themes/redi-blue.toml
index bb25bc2..03ecf0d 100644
--- a/assets/themes/redi-blue.toml
+++ b/assets/themes/redi-blue.toml
@@ -104,6 +104,10 @@ calendar_radius = 4
osd_radius = 4
start_button_radius = 4
+[layout]
+taskbar_position = "bottom"
+dock_enabled = false
+
[assets]
color_scheme = "dark"
wallpaper = "wallpaper-blue.png"
diff --git a/assets/themes/redi-mocha.toml b/assets/themes/redi-mocha.toml
index 1876369..77d5224 100644
--- a/assets/themes/redi-mocha.toml
+++ b/assets/themes/redi-mocha.toml
@@ -9,6 +9,7 @@ description = "Catppuccin Mocha with mauve accents and the Auckland skyline."
# Catppuccin Mocha: https://catppuccin.com/palette/#mocha
# Base #1e1e2e, mantle #181825, crust #11111b; mauve #cba6f7.
# Keep RediWM's default fonts and geometry.
+taskbar_size = 44
# Window chrome
window_bg = "rgba(24,24,37,0.80)"
@@ -140,6 +141,10 @@ pdf_loading = "#a6adc8"
pdf_search_match = "rgba(249,226,175,0.40)"
pdf_search_match_active = "rgba(250,179,135,0.65)"
+[layout]
+taskbar_position = "bottom"
+dock_enabled = false
+
[assets]
color_scheme = "dark"
wallpaper = "wallpaper-mocha.png"
diff --git a/assets/themes/rediwm-dark.toml b/assets/themes/rediwm-dark.toml
index a13c2b5..c135f1f 100644
--- a/assets/themes/rediwm-dark.toml
+++ b/assets/themes/rediwm-dark.toml
@@ -82,5 +82,9 @@ start_menu_selected_bg = "rgba(255,255,255,0.045)"
start_menu_selected_border = "rgba(237,27,46,0.350)"
start_menu_selected_marker = "rgba(237,27,46,1.000)"
+[layout]
+taskbar_position = "bottom"
+dock_enabled = false
+
[assets]
color_scheme = "dark"
diff --git a/assets/themes/rediwm-light.toml b/assets/themes/rediwm-light.toml
index a66f5f0..c1b3c2f 100644
--- a/assets/themes/rediwm-light.toml
+++ b/assets/themes/rediwm-light.toml
@@ -126,5 +126,9 @@ file_broken = "#168579"
battery_critical = "#168579"
desktop_notice_bg = "rgba(8,42,36,0.95)"
+[layout]
+taskbar_position = "bottom"
+dock_enabled = false
+
[assets]
color_scheme = "light"
diff --git a/build.zig b/build.zig
index 73614e3..70b8cdf 100644
--- a/build.zig
+++ b/build.zig
@@ -86,6 +86,14 @@ pub fn build(b: *std.Build) void {
ui_mod.addAnonymousImport("theme-rediwm-light", .{ .root_source_file = b.path("assets/themes/rediwm-light.toml") });
ui_mod.addAnonymousImport("theme-redi-blue", .{ .root_source_file = b.path("assets/themes/redi-blue.toml") });
ui_mod.addAnonymousImport("theme-redi-mocha", .{ .root_source_file = b.path("assets/themes/redi-mocha.toml") });
+ ui_mod.addAnonymousImport("theme-gold", .{ .root_source_file = b.path("assets/themes/gold.toml") });
+ b.getInstallStep().dependOn(&b.addInstallDirectory(.{
+ .source_dir = b.path("assets/themes/gold"),
+ .install_dir = .prefix,
+ .install_subdir = "share/rediwm/themes/gold",
+ }).step);
+ b.getInstallStep().dependOn(&b.addInstallFileWithDir(b.path("assets/themes/gold.toml"), .prefix, "share/rediwm/themes/gold/theme.toml").step);
+ b.getInstallStep().dependOn(&b.addInstallFileWithDir(b.path("assets/wallpapers/wallpaper-gold.png"), .prefix, "share/rediwm/themes/gold/wallpapers/wallpaper-gold.png").step);
const dbus_mod = b.createModule(.{ .root_source_file = b.path("src/dbus/mod.zig"), .target = target, .optimize = optimize, .link_libc = true });
dbus_mod.addImport("wayland", wayland);
dbus_mod.linkSystemLibrary("wayland-server", .{});
diff --git a/docs/themes.md b/docs/themes.md
index d91b985..3f486b7 100644
--- a/docs/themes.md
+++ b/docs/themes.md
@@ -10,7 +10,7 @@ own icons (the pack's `icon_theme`, when specified, takes precedence).
**Install theme…** accepts a `.rediwm-theme` or `.zip` file. **Remove** is
available for user-installed packs and switches an active pack to RediWM Dark.
An existing pack requires **Replace installed theme**. **Save look…** saves
-the current colours, geometry, wallpaper and logo as an installed pack and a
+the current colours, geometry, layout, wallpaper, logo and pack icon/glyph overrides as an installed pack and a
shareable archive; use a lowercase filename such as `my-look.rediwm-theme`.
Files installs `.rediwm-theme` files when opened and reports the result.
@@ -75,11 +75,68 @@ watched and no additional polling is introduced.
Discovery uses the first occurrence of an ID: `$XDG_DATA_HOME/rediwm/themes`,
legacy config presets, the binary's `../share/rediwm/themes`,
`$XDG_DATA_DIRS/rediwm/themes`, then the embedded RediWM Dark, RediWM Light,
-Redi Blue and Redi-Mocha packs. Without `XDG_DATA_HOME`, use `~/.local/share`.
+Redi Blue, Redi-Mocha and Gold packs. Without `XDG_DATA_HOME`, use `~/.local/share`.
Redi-Mocha uses the [Catppuccin Mocha palette](https://catppuccin.com/palette/#mocha)
with mauve accents and the bundled `wallpaper-mocha.png` Auckland skyline.
+Gold uses warm charcoal decorations, ivory app content, champagne accents,
+the bundled gold wallpaper and colour icons. It puts the taskbar at the top
+and enables the bottom dock. Notifications use tinted backdrop glass.
+RediWM Dark, RediWM Light, Redi Blue and Redi-Mocha explicitly restore the
+standard 44-pixel taskbar at the bottom with the dock disabled.
+
+## Layout defaults
+
+Packs may include this optional section:
+
+```toml
+[layout]
+taskbar_position = "top" # top or bottom
+dock_enabled = true
+dock_height = 76 # 48–96 logical pixels
+```
+
+Only these appearance settings are accepted here. Resolution is compositor
+defaults → pack layout → explicit `[compositor]` settings. Choosing a theme
+or **Reset to theme** clears these three personal overrides; a pack without
+layout values returns to the ordinary bottom taskbar and disabled dock.
+Hidden dock entries and application preferences are preserved. **Save look…**
+includes the current layout.
+
+## Separate surface palettes
+
+Optional `[theme]` colours `app_fg`, `app_sidebar_fg`, `app_sidebar_selected`, `app_menu_bg`,
+`app_field_bg` and `app_field_border` let client content differ from window
+decorations. The shared app loader resolves them for Files, Images, Editor
+and PDF, including their controls. Unset values keep existing theme behaviour.
+GTK colour export also uses the app and sidebar foregrounds.
+
+`dock_bg` and `dock_border` override the taskbar-derived dock colours;
+`dock_radius` is in logical pixels (zero follows the window frame radius).
+An explicit dock background uses its own alpha without the inherited dock's
+86% minimum. `notification_bg`, `notification_fg`, `notification_dim`,
+`notification_border`, `notification_icon_bg` and `notification_radius`
+control notification cards. `notification_blur = true` enables the existing
+backdrop renderer behind them. Defaults retain the previous appearance.
+
+## Terminal palette
+
+For Foot launched from RediWM's default-terminal action, dock, Start menu or
+desktop, a pack can supply `terminal_bg`, `terminal_fg`, `terminal_cursor`,
+`terminal_black`, `terminal_red`, `terminal_green`, `terminal_yellow`,
+`terminal_blue`, `terminal_magenta`, `terminal_cyan`, `terminal_white` and the
+corresponding `terminal_bright_*` colours. Entries are optional; unset entries
+keep Foot's configuration. Gold supplies a complete palette with champagne
+text and distinct ANSI colours.
+
+A short-lived `rediwm-theme terminal foot …` helper reads the active theme,
+detects Foot's older single-palette or newer dark/light configuration format,
+and replaces itself with Foot. It writes no terminal configuration and keeps
+explicit launcher overrides. Existing windows, terminals started directly
+from another shell, Foot server clients and other terminal emulators retain
+their own colours. The palette applies to newly launched Foot windows.
+
The helper is also available from a terminal:
```sh
diff --git a/scripts/pack-themes.sh b/scripts/pack-themes.sh
index 11bb849..17d26ac 100755
--- a/scripts/pack-themes.sh
+++ b/scripts/pack-themes.sh
@@ -37,6 +37,10 @@ for toml in "$here"/assets/themes/*.toml; do
dir="$work/$id"
mkdir -p "$dir"
cp "$toml" "$dir/theme.toml"
+ # Optional pack artwork, already sized and named for shared icon lookup.
+ if [ -d "$here/assets/themes/$id" ]; then
+ cp -R "$here/assets/themes/$id/." "$dir/"
+ fi
# wallpaper = "name" under [assets] names a file in wallpapers/.
wallpaper=$(sed -n 's/^wallpaper = "\(.*\)"$/\1/p' "$toml" | head -n 1)
diff --git a/src/Dock.zig b/src/Dock.zig
index fd31baa..5693ff7 100644
--- a/src/Dock.zig
+++ b/src/Dock.zig
@@ -351,8 +351,8 @@ fn paint(self: *Self, now_ms: i64) !void {
const output = self.output.?;
const m = self.metrics();
const pal = ui.theme.shellPalette();
- var bg = ui.theme.taskbar(.taskbar_bg);
- bg[3] = @max(bg[3], 0.86);
+ var bg = pal.dock_bg orelse ui.theme.taskbar(.taskbar_bg);
+ if (pal.dock_bg == null) bg[3] = @max(bg[3], 0.86);
const focused = @import("ipc/handlers.zig").findFocusedToplevel(output.server);
var looks: [max_items]Look = undefined;
self.pills_animating = false;
@@ -399,7 +399,8 @@ fn paintDock(self: *Self, pal: ui.theme.Theme, bg: [4]f32, looks: []const Look)
r.palette = pal;
var border = pal.accent;
border[3] = 0.55;
- const radius = @min(ui.window_chrome.frameRadius(), @as(f32, @floatFromInt(self.box.height)) / 2);
+ border = pal.dock_border orelse border;
+ const radius = @min(if (pal.dock_radius > 0) pal.dock_radius else ui.window_chrome.frameRadius(), @as(f32, @floatFromInt(self.box.height)) / 2);
glass.Effect.configure(self.glass_effect, radius, 1);
r.fillRect(0, 0, @floatFromInt(self.box.width), @floatFromInt(self.box.height), .{ .color = bg, .radius = radius, .border_width = 1, .border_color = border });
for (self.buttons[0..self.count], looks, 0..) |button, look, index| {
diff --git a/src/config/app_theme.zig b/src/config/app_theme.zig
index 9a353db..2d017dc 100644
--- a/src/config/app_theme.zig
+++ b/src/config/app_theme.zig
@@ -47,6 +47,7 @@ pub const Palette = struct {
fg: Color,
toolbar: Color,
sidebar: Color,
+ sidebar_fg: Color,
item: Color,
hover: Color,
border: Color,
@@ -55,7 +56,8 @@ pub const Palette = struct {
danger: Color,
dim: Color,
- pub fn fromTheme(t: theme.Theme) Palette {
+ pub fn fromTheme(source: theme.Theme) Palette {
+ const t = source.forApp();
const bg = composite(t.app_bg, .{ 255, 255, 255 });
const fg = composite(t.window_fg, bg);
const accent = composite(t.shell_accent orelse t.start_menu_selected_marker, bg);
@@ -64,6 +66,7 @@ pub const Palette = struct {
.fg = fg,
.toolbar = composite(t.app_toolbar, bg),
.sidebar = composite(t.app_sidebar, bg),
+ .sidebar_fg = composite(t.sidebarForeground(), composite(t.app_sidebar, bg)),
.item = composite(t.app_item, bg),
.hover = composite(t.app_item_hover, bg),
.border = composite(t.app_item_border, bg),
@@ -130,11 +133,11 @@ pub fn gtkColors(a: Allocator, p: Palette, gtk4: bool) ![]u8 {
"theme_unfocused_selected_bg_color", "theme_unfocused_selected_fg_color", "insensitive_fg_color",
};
const colors = [_]Color{
- p.bg, p.fg, p.bg, p.fg, p.toolbar, p.fg, p.toolbar,
- p.sidebar, p.fg, p.sidebar, p.sidebar, p.fg, p.item, p.fg,
- p.bg, p.fg, p.toolbar, p.fg, p.accent, p.on_accent, p.accent,
- p.border, p.bg, p.fg, p.bg, p.fg, p.accent, p.on_accent,
- p.bg, p.fg, p.bg, p.fg, p.accent, p.on_accent, p.dim,
+ p.bg, p.fg, p.bg, p.fg, p.toolbar, p.fg, p.toolbar,
+ p.sidebar, p.sidebar_fg, p.sidebar, p.sidebar, p.sidebar_fg, p.item, p.fg,
+ p.bg, p.fg, p.toolbar, p.fg, p.accent, p.on_accent, p.accent,
+ p.border, p.bg, p.fg, p.bg, p.fg, p.accent, p.on_accent,
+ p.bg, p.fg, p.bg, p.fg, p.accent, p.on_accent, p.dim,
};
for (names, colors) |name, color| try appendFmt(&out, a, "@define-color {s} {s};\n", .{ name, hex(color) });
try appendFmt(&out, a, "@define-color destructive_bg_color {s};\n@define-color destructive_fg_color {s};\n", .{ hex(p.danger), hex(contrast(p.danger)) });
@@ -174,7 +177,10 @@ pub fn qtColors(a: Allocator, p: Palette) ![]u8 {
try out.appendSlice(a, "[ColorScheme]\n");
// QPalette::ColorRole order, including NoRole, PlaceholderText and Qt6's
// Accent. Extra roles are ignored by Qt5 and older Qt6.
- const active = [_]Color{ p.fg, p.item, blend(p.item, .{ 255, 255, 255 }, 0.7), p.hover, p.border, p.border, p.fg, p.fg, p.fg, p.bg, p.bg, p.border, p.accent, p.on_accent, p.accent, p.accent, p.sidebar, p.bg, p.toolbar, p.fg, p.dim, p.accent };
+ // QPalette has no separate foreground for AlternateBase. A contrasting
+ // sidebar cannot also be used for alternating rows with the content text.
+ const alternate = if (std.meta.eql(p.sidebar_fg, p.fg)) p.sidebar else p.item;
+ const active = [_]Color{ p.fg, p.item, blend(p.item, .{ 255, 255, 255 }, 0.7), p.hover, p.border, p.border, p.fg, p.fg, p.fg, p.bg, p.bg, p.border, p.accent, p.on_accent, p.accent, p.accent, alternate, p.bg, p.toolbar, p.fg, p.dim, p.accent };
for ([_][]const u8{ "active_colors", "inactive_colors", "disabled_colors" }, 0..) |name, group| {
try appendFmt(&out, a, "{s}=", .{name});
for (active, 0..) |color, role| {
@@ -407,6 +413,15 @@ test "app palettes composite straight alpha and choose readable accent text" {
t.shell_accent = .{ 0, 0, 0, 1 };
p = Palette.fromTheme(t);
try std.testing.expectEqual(Color{ 255, 255, 255 }, p.on_accent);
+ t.app_bg = .{ 1, 1, 1, 1 };
+ t.app_fg = .{ 0.2, 0.1, 0, 1 };
+ t.app_sidebar = .{ 0, 0, 0, 1 };
+ t.app_sidebar_fg = .{ 1, 1, 1, 1 };
+ p = Palette.fromTheme(t);
+ try std.testing.expectEqual(Color{ 51, 26, 0 }, p.fg);
+ try std.testing.expectEqual(Color{ 255, 255, 255 }, p.sidebar_fg);
+ try std.testing.expectEqual(t.app_fg.?, t.forApp().window_fg);
+ try std.testing.expectEqual((theme.Theme{}).window_fg, t.window_fg);
}
test "app colors edits are idempotent and scoped to their INI section" {
diff --git a/src/config/loader.zig b/src/config/loader.zig
index dada739..e0ba32a 100644
--- a/src/config/loader.zig
+++ b/src/config/loader.zig
@@ -132,7 +132,7 @@ pub const CompositorConfig = struct {
dock_hidden_apps: []const []const u8 = &.{},
dock_hidden_shortcuts: []const []const u8 = &.{},
taskbar_items: TaskbarItems = .{},
- taskbar_position: enum { top, bottom } = .bottom,
+ taskbar_position: types.TaskbarPosition = .bottom,
/// App identities opted into compositor tabs. Only + launches join a group.
window_tab_apps: []const []const u8 = &.{},
focus_follows_mouse: bool = false,
@@ -479,6 +479,7 @@ pub fn loadFromBytes(
cfg.theme = p.tokens;
try theme_mod.overlay(a, &cfg.theme, bytes);
if (cfg.taskbar_theme == null) cfg.taskbar_theme = p.taskbar;
+ p.layout.apply(&cfg.compositor);
if (p.color_scheme) |dark| cfg.compositor.dark_mode = dark;
if (p.cursor_theme.len > 0) {
cfg.input.cursor_theme = if (std.mem.eql(u8, p.cursor_theme, "pack"))
@@ -508,6 +509,11 @@ pub fn loadFromBytes(
const key = std.mem.trim(u8, line[0..eq], " \t");
const value = std.mem.trim(u8, line[eq + 1 ..], " \t");
if (std.mem.eql(u8, section, "[compositor]") and std.mem.eql(u8, key, "dark_mode")) cfg.compositor.dark_mode = std.mem.eql(u8, value, "true");
+ if (std.mem.eql(u8, section, "[compositor]")) {
+ inline for (@import("theme_pack.zig").Layout.keys) |layout_key| {
+ if (std.mem.eql(u8, key, layout_key)) try applyCompositorKey(&cfg.compositor, cfg.arena.allocator(), key, value);
+ }
+ }
if (std.mem.eql(u8, section, "[input]") and std.mem.eql(u8, key, "cursor_theme")) cfg.input.cursor_theme = try cfg.arena.allocator().dupe(u8, try theme_mod.unquote(value));
}
}
@@ -2328,6 +2334,17 @@ test "no base preserves legacy themes and embedded base layers config overrides"
try std.testing.expectEqual(@as(f32, 14), based.theme.font_size);
try std.testing.expect(themeEql(based.theme_defaults, based.theme_pack.?.tokens));
try std.testing.expectEqual(based.theme_defaults.accent, based.theme.accent);
+
+ var gold = try loadFromBytes(a, "[theme]\nbase = \"gold\"\n", "gold", .empty, std.testing.io);
+ defer gold.deinit();
+ try std.testing.expectEqual(.top, gold.compositor.taskbar_position);
+ try std.testing.expect(gold.compositor.dock_enabled);
+ try std.testing.expectEqual(@as(u32, 76), gold.compositor.dock_height);
+ var customized = try loadFromBytes(a, "[theme]\nbase = \"gold\"\n[compositor]\ntaskbar_position = \"bottom\"\ndock_enabled = false\ndock_height = 52\n", "gold", .empty, std.testing.io);
+ defer customized.deinit();
+ try std.testing.expectEqual(.bottom, customized.compositor.taskbar_position);
+ try std.testing.expect(!customized.compositor.dock_enabled);
+ try std.testing.expectEqual(@as(u32, 52), customized.compositor.dock_height);
}
test "external overlay wins over a referenced pack without pinning inherited tokens" {
diff --git a/src/config/mod.zig b/src/config/mod.zig
index 912b332..c2a2e46 100644
--- a/src/config/mod.zig
+++ b/src/config/mod.zig
@@ -16,6 +16,7 @@ pub const setting_save = @import("setting_save.zig");
pub const shortcut_save = @import("shortcut_save.zig");
pub const taskbar_items = @import("taskbar_items.zig");
pub const theme_pack = @import("theme_pack.zig");
+pub const terminal_theme = @import("terminal_theme.zig");
pub const types = @import("types.zig");
pub const workspace_layout = @import("workspace_layout.zig");
pub const window_rules = @import("window_rules.zig");
diff --git a/src/config/setting_save.zig b/src/config/setting_save.zig
index eee6507..66aad0b 100644
--- a/src/config/setting_save.zig
+++ b/src/config/setting_save.zig
@@ -15,6 +15,33 @@ pub fn saveCompositor(allocator: std.mem.Allocator, io: Io, path: []const u8, co
} else try save(allocator, io, path, "compositor", key, value);
}
+/// A pack switch/reset clears only layout edits owned by themes. Keep user
+/// launchers, hidden dock entries and unrelated compositor preferences.
+pub fn resetThemeLayout(allocator: std.mem.Allocator, io: Io, path: []const u8) !void {
+ const original = try Io.Dir.cwd().readFileAlloc(io, path, allocator, .limited(1 << 20));
+ defer allocator.free(original);
+ var result: std.ArrayList(u8) = .empty;
+ defer result.deinit(allocator);
+ var in_compositor = false;
+ var lines = std.mem.splitScalar(u8, original, '\n');
+ var offset: usize = 0;
+ while (lines.next()) |raw| {
+ const end = @min(original.len, offset + raw.len + 1);
+ const line = theme.stripComment(std.mem.trim(u8, raw, " \t\r"));
+ if (std.mem.startsWith(u8, line, "[")) in_compositor = std.mem.eql(u8, line, "[compositor]");
+ var remove = false;
+ if (in_compositor) if (std.mem.indexOfScalar(u8, line, '=')) |eq| {
+ const key = std.mem.trim(u8, line[0..eq], " \t\"");
+ inline for (@import("theme_pack.zig").Layout.keys) |layout_key| {
+ if (std.mem.eql(u8, key, layout_key)) remove = true;
+ }
+ };
+ if (!remove) try result.appendSlice(allocator, original[offset..end]);
+ offset = end;
+ }
+ try writeValidated(allocator, io, path, result.items);
+}
+
pub fn saveRegion(allocator: std.mem.Allocator, io: Io, path: []const u8, comptime key: []const u8, value: @FieldType(loader.RegionConfig, key)) !void {
try save(allocator, io, path, "region", key, value);
}
diff --git a/src/config/terminal_theme.zig b/src/config/terminal_theme.zig
new file mode 100644
index 0000000..6c1e8df
--- /dev/null
+++ b/src/config/terminal_theme.zig
@@ -0,0 +1,78 @@
+//! Per-launch Foot colours. No user terminal configuration is overwritten.
+const std = @import("std");
+const Theme = @import("ui").theme.Theme;
+const A = std.mem.Allocator;
+
+const names = .{ "bg", "fg", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "bright_black", "bright_red", "bright_green", "bright_yellow", "bright_blue", "bright_magenta", "bright_cyan", "bright_white" };
+const options = .{ "background", "foreground", "regular0", "regular1", "regular2", "regular3", "regular4", "regular5", "regular6", "regular7", "bright0", "bright1", "bright2", "bright3", "bright4", "bright5", "bright6", "bright7" };
+
+pub fn enabled(t: Theme) bool {
+ inline for (names) |name| if (@field(t, "terminal_" ++ name) != null) return true;
+ return t.terminal_cursor != null;
+}
+
+/// Uses the caller's short-lived launch arena; original arguments are borrowed.
+/// The helper probes Foot's config dialect outside the compositor, then execs
+/// Foot in the same process/scope. Other terminal emulators keep their argv.
+pub fn wrap(a: A, io: std.Io, args: []const []const u8, t: Theme) ![]const []const u8 {
+ if (args.len == 0 or !enabled(t) or !std.mem.eql(u8, std.fs.path.basename(args[0]), "foot")) return args;
+ const directory = try std.process.executableDirPathAlloc(io, a);
+ const result = try a.alloc([]const u8, args.len + 2);
+ result[0] = try std.fs.path.join(a, &.{ directory, "rediwm-theme" });
+ result[1] = "terminal";
+ @memcpy(result[2..], args);
+ return result;
+}
+
+fn hex(a: A, color: [4]f32) ![]const u8 {
+ var rgb: [3]u8 = undefined;
+ for (&rgb, color[0..3]) |*byte, value| byte.* = @intFromFloat(@round(std.math.clamp(value, 0, 1) * 255));
+ return std.fmt.allocPrint(a, "{x:0>2}{x:0>2}{x:0>2}", .{ rgb[0], rgb[1], rgb[2] });
+}
+
+/// Newer Foot has dark/light palettes; older Foot has a single [colors].
+/// Strings are owned by the caller's arena. Pack overrides precede explicit
+/// command-line overrides, so a custom launcher can still choose its colours.
+pub fn argv(a: A, args: []const []const u8, t: Theme, modern: bool) ![]const []const u8 {
+ var result: std.ArrayList([]const u8) = .empty;
+ try result.append(a, args[0]);
+ const sections: []const []const u8 = if (modern) &.{ "colors-dark", "colors-light" } else &.{"colors"};
+ for (sections) |section| {
+ inline for (names, options) |name, option| {
+ if (@field(t, "terminal_" ++ name)) |color| {
+ try result.append(a, try std.fmt.allocPrint(a, "--override={s}.{s}={s}", .{ section, option, try hex(a, color) }));
+ }
+ }
+ if (t.terminal_cursor) |color| {
+ const bg = try hex(a, t.terminal_bg orelse t.window_bg);
+ const fg = try hex(a, color);
+ if (modern) try result.append(a, try std.fmt.allocPrint(a, "--override={s}.cursor={s} {s}", .{ section, bg, fg }));
+ }
+ }
+ if (!modern) if (t.terminal_cursor) |color| {
+ try result.append(a, try std.fmt.allocPrint(a, "--override=cursor.color={s} {s}", .{ try hex(a, t.terminal_bg orelse t.window_bg), try hex(a, color) }));
+ };
+ try result.appendSlice(a, args[1..]);
+ return result.toOwnedSlice(a);
+}
+
+test "Foot palettes preserve arguments and support both config dialects" {
+ var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
+ defer arena.deinit();
+ const a = arena.allocator();
+ const t: Theme = .{ .terminal_fg = .{ 1, 0.5, 0, 1 }, .terminal_bg = .{ 0, 0, 0, 1 }, .terminal_cursor = .{ 1, 1, 1, 1 } };
+ const args: []const []const u8 = &.{ "foot", "-D", "/tmp/a b", "-e", "printf", "%s", "literal; text" };
+ for ([_]bool{ false, true }) |modern| {
+ const result = try argv(a, args, t, modern);
+ try std.testing.expectEqualStrings("foot", result[0]);
+ for (args[1..], result[result.len - (args.len - 1) ..]) |expected, actual| try std.testing.expectEqualStrings(expected, actual);
+ const expected = if (modern) "--override=colors-dark.foreground=ff8000" else "--override=colors.foreground=ff8000";
+ var found = false;
+ for (result) |arg| if (std.mem.eql(u8, arg, expected)) {
+ found = true;
+ };
+ try std.testing.expect(found);
+ }
+ try std.testing.expect(!enabled(.{}));
+ try std.testing.expectEqualSlices([]const u8, args, try wrap(a, std.testing.io, args, .{}));
+}
diff --git a/src/config/theme_pack.zig b/src/config/theme_pack.zig
index b4dbed2..422d963 100644
--- a/src/config/theme_pack.zig
+++ b/src/config/theme_pack.zig
@@ -6,6 +6,42 @@ const presets = @import("ui").theme_presets;
const A = std.mem.Allocator;
const Io = std.Io;
+/// Only appearance-related layout defaults belong to packs. User overrides
+/// remain in [compositor]; packs cannot inject other compositor settings.
+pub const Layout = struct {
+ taskbar_position: ?@import("types.zig").TaskbarPosition = null,
+ dock_enabled: ?bool = null,
+ dock_height: ?u32 = null,
+
+ pub const keys = .{ "taskbar_position", "dock_enabled", "dock_height" };
+
+ pub fn apply(self: Layout, compositor: anytype) void {
+ inline for (keys) |key| if (@field(self, key)) |value| {
+ @field(compositor, key) = value;
+ };
+ }
+
+ fn parseKey(self: *Layout, key: []const u8, value: []const u8) !void {
+ if (std.mem.eql(u8, key, "taskbar_position")) {
+ self.taskbar_position = std.meta.stringToEnum(@import("types.zig").TaskbarPosition, try theme.unquote(value)) orelse return error.InvalidLayout;
+ } else if (std.mem.eql(u8, key, "dock_enabled")) {
+ self.dock_enabled = if (std.mem.eql(u8, value, "true")) true else if (std.mem.eql(u8, value, "false")) false else return error.InvalidLayout;
+ } else if (std.mem.eql(u8, key, "dock_height")) {
+ const height = std.fmt.parseInt(u32, value, 10) catch return error.InvalidLayout;
+ if (height < 48 or height > 96) return error.InvalidLayout;
+ self.dock_height = height;
+ } else return error.InvalidLayout;
+ }
+
+ pub fn write(a: A, bytes: *std.ArrayList(u8), compositor: anytype) !void {
+ const text = try std.fmt.allocPrint(a, "[layout]\ntaskbar_position = \"{s}\"\ndock_enabled = {}\ndock_height = {d}\n", .{
+ @tagName(compositor.taskbar_position), compositor.dock_enabled, compositor.dock_height,
+ });
+ defer a.free(text);
+ try bytes.appendSlice(a, text);
+ }
+};
+
pub const Pack = struct {
id: []const u8,
name: []const u8,
@@ -17,6 +53,7 @@ pub const Pack = struct {
bytes: []const u8,
tokens: theme.Theme = .{},
taskbar: ?theme.Theme = null,
+ layout: Layout = .{},
wallpaper: []const u8 = "",
color_scheme: ?bool = null,
icon_theme: []const u8 = "",
@@ -97,6 +134,8 @@ pub fn parse(a: A, bytes: []const u8, fallback_id: []const u8, root: []const u8)
}
} else if (std.mem.eql(u8, section, "taskbar_theme")) {
_ = try theme.applyTaskbarKey(a, &p.taskbar.?, key, value);
+ } else if (std.mem.eql(u8, section, "layout")) {
+ try p.layout.parseKey(key, value);
} else if (std.mem.eql(u8, section, "assets")) {
const text = try theme.unquote(value);
if (std.mem.eql(u8, key, "color_scheme")) {
@@ -198,6 +237,10 @@ test "pack metadata, future tokens and unsafe paths" {
try std.testing.expectError(error.UnsafeAssetPath, parse(a, "[theme]\nstart_button_icon = \"../logo.svg\"", "nord", "/tmp/nord"));
for ([_][]const u8{ "../x", "/x", "x//y", "x/./y", "x\\y" }) |path| try std.testing.expect(!relative(path));
try std.testing.expect(!validId("../nord"));
+ for ([_][]const u8{ "dock_height = 47", "dock_height = 97", "dock_enabled = 1", "taskbar_position = \"left\"", "xwayland = true" }) |line| {
+ const bytes = try std.fmt.allocPrint(a, "[layout]\n{s}\n", .{line});
+ try std.testing.expectError(error.InvalidLayout, parse(a, bytes, "test", ""));
+ }
}
fn legacyId(a: A, name: []const u8) ![]const u8 {
diff --git a/src/config/types.zig b/src/config/types.zig
index 82de50f..4a9e9ce 100644
--- a/src/config/types.zig
+++ b/src/config/types.zig
@@ -1,5 +1,6 @@
const std = @import("std");
pub const PanModifier = enum { super, super_alt };
+pub const TaskbarPosition = enum { top, bottom };
pub const AccelProfile = enum {
flat,
diff --git a/src/config_runtime/actions.zig b/src/config_runtime/actions.zig
index 5c63b8d..4db480e 100644
--- a/src/config_runtime/actions.zig
+++ b/src/config_runtime/actions.zig
@@ -106,17 +106,17 @@ fn tileFocused(server: *Server, dir: snap.Direction) void {
}
pub fn spawnProcess(server: *Server, cmd: []const u8) void {
- spawnTracked(server, cmd, false);
+ spawnTracked(server, cmd, false, &.{ "/bin/sh", "-c", cmd });
}
pub fn spawnHelper(server: *Server, cmd: []const u8) void {
if (server.services) |manager| {
if (manager.helperRunning(cmd)) return;
}
- spawnTracked(server, cmd, true);
+ spawnTracked(server, cmd, true, &.{ "/bin/sh", "-c", cmd });
}
-fn spawnTracked(server: *Server, cmd: []const u8, helper: bool) void {
+fn spawnTracked(server: *Server, cmd: []const u8, helper: bool, argv: []const []const u8) void {
var env_map = server.environ.createMap(gpa) catch |err| {
log.warn("autostart/spawn env: {}", .{err});
return;
@@ -127,7 +127,7 @@ fn spawnTracked(server: *Server, cmd: []const u8, helper: bool) void {
return;
};
const child = std.process.spawn(server.io, .{
- .argv = &.{ "/bin/sh", "-c", cmd },
+ .argv = argv,
.environ_map = &env_map,
.pgid = if (helper) 0 else null,
}) catch |err| {
@@ -626,5 +626,13 @@ fn launchPreferred(server: *Server, cmd: []const u8) void {
}
log.warn("preferred application '{s}' is no longer installed; using fallback", .{id});
}
- spawnProcess(server, if (file_manager) "rediwm-files" else server.environ.getPosix("TERMINAL") orelse "foot");
+ if (file_manager) return spawnProcess(server, "rediwm-files");
+ const command = server.environ.getPosix("TERMINAL") orelse "foot";
+ var arena = std.heap.ArenaAllocator.init(gpa);
+ defer arena.deinit();
+ const args = @import("../start_menu/launch.zig").parseExec(arena.allocator(), command, null) catch return;
+ if (args.len == 0) return;
+ const themed = @import("config").terminal_theme.wrap(arena.allocator(), server.io, args, server.config.theme) catch return;
+ if (themed.ptr == args.ptr) return spawnProcess(server, command);
+ spawnTracked(server, command, false, themed);
}
diff --git a/src/config_runtime/apply.zig b/src/config_runtime/apply.zig
index 3ff2b5f..64cca7d 100644
--- a/src/config_runtime/apply.zig
+++ b/src/config_runtime/apply.zig
@@ -170,6 +170,7 @@ pub fn applyDiff(server: *Server, old: Config, new: Config) void {
const theme_changed = pack_changed or !themeEql(old.theme, new.theme) or old.compositor.border_radius != new.compositor.border_radius;
const taskbar_theme_changed = !theme_mod.taskbarOverrideEql(old.taskbar_theme, new.taskbar_theme);
if (theme_changed) {
+ if (server.notifications) |manager| manager.themeChanged();
if (server.desktop) |desktop| desktop.app.themeChanged();
if (server.locker) |lock| lock.themeChanged();
server.refreshTaskbarsGeometry();
diff --git a/src/config_runtime/theme_pack.zig b/src/config_runtime/theme_pack.zig
index 5f59401..4508b4f 100644
--- a/src/config_runtime/theme_pack.zig
+++ b/src/config_runtime/theme_pack.zig
@@ -10,6 +10,7 @@ pub fn apply(server: *Server, id: []const u8) !void {
defer arena.deinit();
const p = (try config.theme_pack.find(arena.allocator(), server.io, server.environ, server.config.path, id)) orelse return error.ThemeNotFound;
if (server.config.path.len == 0) return error.NoConfigPath;
+ try config.setting_save.resetThemeLayout(main.gpa, server.io, server.config.path);
config.loader.replaceThemeOverrides(main.gpa, server.io, server.config.path, p.tokens, p.tokens, id);
config.loader.replaceTaskbarThemeSection(main.gpa, server.io, server.config.path, p.taskbar);
// Empty wallpaper means the pack default. Explicit later choices pin it.
diff --git a/src/desktop/watcher.zig b/src/desktop/watcher.zig
index 1869c62..856c632 100644
--- a/src/desktop/watcher.zig
+++ b/src/desktop/watcher.zig
@@ -571,7 +571,16 @@ pub const Worker = struct {
try args.appendSlice(mem, &.{ if (cmd.folder and executable(self.environ, "rediwm-files")) "rediwm-files" else "xdg-open", cmd.path });
}
if (args.items.len == 0) return error.EmptyCommand;
- var child = try std.process.spawn(self.io, .{ .argv = args.items, .cwd = cwd, .environ_map = &self.child_env });
+ var themed: []const []const u8 = args.items;
+ if (std.mem.eql(u8, std.fs.path.basename(args.items[0]), "foot")) {
+ const cfg_path = @import("config").path.resolvePath(self.environ, mem) catch "";
+ if (@import("config").loader.load(cfg_path, mem, self.io, self.environ)) |loaded| {
+ var cfg = loaded;
+ defer cfg.deinit();
+ themed = try @import("config").terminal_theme.wrap(mem, self.io, args.items, cfg.theme);
+ } else |_| {}
+ }
+ var child = try std.process.spawn(self.io, .{ .argv = themed, .cwd = cwd, .environ_map = &self.child_env });
var launched = Launched{ .token = cmd.token, .pid = child.id orelse 0 };
launched.setApp(std.fs.path.stem(std.fs.path.basename(cmd.path)));
// A launcher names its scope; an opened file names it after the program.
diff --git a/src/files/app.zig b/src/files/app.zig
index 4bf7d43..debd2f3 100644
--- a/src/files/app.zig
+++ b/src/files/app.zig
@@ -3172,7 +3172,7 @@ pub const App = struct {
/// an eject button on the mounted ones.
fn renderDevices(self: *App, cr: *c.cairo_t, content_width: f64) void {
if (self.device_list.items.len == 0) return;
- setSource(cr, ui_theme.global.window_fg);
+ setSource(cr, ui_theme.global.sidebarForeground());
drawText(cr, "DEVICES", 24, @floatFromInt(self.placeY(self.deviceBase()) - 12), shell_ui.headingSize(), true);
const accent = ui_theme.shellPalette().accent;
const hovered = self.hoverKey();
@@ -3184,7 +3184,7 @@ pub const App = struct {
if (self.placeActive(index)) {
const row = self.placeRect(index);
roundedRect(cr, row.x, row.y, row.w, row.h, 5);
- setSource(cr, ui_theme.global.app_nav_selected);
+ setSource(cr, ui_theme.global.sidebarSelected());
c.cairo_fill(cr);
roundedRect(cr, 10, y + 3, 3, 24, 1.5);
setSource(cr, accent);
@@ -3195,7 +3195,7 @@ pub const App = struct {
layer.renderer.drawIcon(0, 0, 24, 24, .{ .id = if (volume.kind == .stick) .usb_stick else .drive, .color = withAlpha(ui_theme.global.app_icon, alpha) });
layer.finish();
}
- setSource(cr, withAlpha(ui_theme.global.window_fg, alpha));
+ setSource(cr, withAlpha(ui_theme.global.sidebarForeground(), alpha));
const metrics = fontMetrics(cr, shell_ui.textSize());
var label_buf: [96]u8 = undefined;
const reserve: f64 = if (mounted) 28 else 0;
@@ -3316,7 +3316,7 @@ pub const App = struct {
setSource(cr, withAlpha(ui_theme.global.app_item_hover, glide.alpha));
c.cairo_fill(cr);
}
- setSource(cr, ui_theme.global.window_fg);
+ setSource(cr, ui_theme.global.sidebarForeground());
drawText(cr, "PLACES", 24, @floatFromInt(self.placeY(places_start) - 12), shell_ui.headingSize(), true);
for (0..self.deviceBase()) |i| {
if (!self.placeVisible(i)) continue;
@@ -3335,7 +3335,7 @@ pub const App = struct {
if (active) {
const row = self.placeRect(i);
roundedRect(cr, row.x, row.y, row.w, row.h, 5);
- setSource(cr, ui_theme.global.app_nav_selected);
+ setSource(cr, ui_theme.global.sidebarSelected());
c.cairo_fill(cr);
roundedRect(cr, 10, y + 3, 3, 24, 1.5);
setSource(cr, accent);
@@ -3378,7 +3378,7 @@ pub const App = struct {
roundedRect(cr, 25, y + 10.5, 17, 12, 2);
c.cairo_fill(cr);
}
- setSource(cr, withAlpha(ui_theme.global.window_fg, alpha));
+ setSource(cr, withAlpha(ui_theme.global.sidebarForeground(), alpha));
const metrics = fontMetrics(cr, shell_ui.textSize());
drawEllipsis(cr, label, 54, y + (30 - metrics.ascent - metrics.descent) / 2 + metrics.ascent, content_width - 64, shell_ui.textSize(), false);
}
@@ -3445,18 +3445,18 @@ pub const App = struct {
fn renderGitSidebar(self: *App, cr: *c.cairo_t, content_width: f64) void {
const repo = self.repository() orelse return;
const card = self.gitCard();
- setSource(cr, ui_theme.global.window_fg);
+ setSource(cr, ui_theme.global.sidebarForeground());
drawText(cr, "GIT", 24, card.y - 10, shell_ui.headingSize(), true);
if (shell_ui.Layer.begin(cr, .{ .x = 23, .y = @floatCast(card.y + 6), .w = 20, .h = 20 })) |icon_layer| {
var layer = icon_layer;
- layer.renderer.drawIcon(0, 0, 20, 20, .{ .id = .git_branch, .color = ui_theme.global.window_fg });
+ layer.renderer.drawIcon(0, 0, 20, 20, .{ .id = .git_branch, .color = ui_theme.global.sidebarForeground() });
layer.finish();
}
- setSource(cr, ui_theme.global.window_fg);
+ setSource(cr, ui_theme.global.sidebarForeground());
drawEllipsis(cr, std.fs.path.basename(repo.root), 50, card.y + 22, content_width - 80, shell_ui.textSize(), false);
if (shell_ui.Layer.begin(cr, .{ .x = @floatCast(content_width - 28), .y = @floatCast(card.y + 9), .w = 14, .h = 14 })) |icon_layer| {
var layer = icon_layer;
- layer.renderer.drawIcon(0, 0, 14, 14, .{ .id = if (self.git_expanded) .chevron_down else .chevron_right, .color = ui_theme.global.window_fg });
+ layer.renderer.drawIcon(0, 0, 14, 14, .{ .id = if (self.git_expanded) .chevron_down else .chevron_right, .color = ui_theme.global.sidebarForeground() });
layer.finish();
}
if (!self.git_expanded) return;
@@ -3465,11 +3465,11 @@ pub const App = struct {
for (0..rows + 1) |i| {
const row_y = card.y + git_header_h + @as(f64, @floatFromInt(i)) * git_row_h;
const baseline = row_y + 19;
- setSource(cr, ui_theme.global.window_fg);
+ setSource(cr, ui_theme.global.sidebarForeground());
if (i == rows) {
if (shell_ui.Layer.begin(cr, .{ .x = 24, .y = @floatCast(row_y + 7), .w = 14, .h = 14 })) |icon_layer| {
var layer = icon_layer;
- layer.renderer.drawIcon(0, 0, 14, 14, .{ .id = .plus, .color = ui_theme.global.window_fg });
+ layer.renderer.drawIcon(0, 0, 14, 14, .{ .id = .plus, .color = ui_theme.global.sidebarForeground() });
layer.finish();
}
drawText(cr, "New branch", 44, baseline, shell_ui.textSize(), false);
@@ -3480,7 +3480,7 @@ pub const App = struct {
if (row.current) {
if (shell_ui.Layer.begin(cr, .{ .x = 24, .y = @floatCast(row_y + 7), .w = 14, .h = 14 })) |icon_layer| {
var layer = icon_layer;
- layer.renderer.drawIcon(0, 0, 14, 14, .{ .id = .checkmark, .color = ui_theme.global.window_fg });
+ layer.renderer.drawIcon(0, 0, 14, 14, .{ .id = .checkmark, .color = ui_theme.global.sidebarForeground() });
layer.finish();
}
if (repo.upstream) {
diff --git a/src/files/settings.zig b/src/files/settings.zig
index 7c393e5..54b86e3 100644
--- a/src/files/settings.zig
+++ b/src/files/settings.zig
@@ -54,7 +54,7 @@ pub const ThemeUpdate = struct {
/// Transfers ownership to the UI thread. Never call from a worker.
pub fn apply(self: ThemeUpdate) void {
@import("ui").shell_icons.configure(self.io, self.pack_root);
- theme.global = self.value;
+ theme.global = self.value.forApp();
region = self.region;
text.setPreferredFamilies(self.value.font, self.value.mono_font);
if (applied_theme) |old| old.deinit();
diff --git a/src/glass.c b/src/glass.c
index a462ea2..9c53b24 100644
--- a/src/glass.c
+++ b/src/glass.c
@@ -139,6 +139,11 @@ void rediwm_glass_configure(struct glass_effect *effect, float radius, float opa
effect->radius = radius;
effect->opacity = opacity;
}
+void rediwm_glass_detach(struct glass_effect *effect)
+{
+ if (effect)
+ wlr_scene_node_destroy(&effect->node->node);
+}
void rediwm_glass_destroy(struct glass_engine *engine)
{
if (!engine)
diff --git a/src/glass.zig b/src/glass.zig
index 674b763..fa6a610 100644
--- a/src/glass.zig
+++ b/src/glass.zig
@@ -4,6 +4,8 @@ const wlr = @import("wlroots");
pub const Kind = enum(c_int) { titlebar, taskbar, panel };
pub const Effect = opaque {
+ extern fn rediwm_glass_detach(effect: ?*Effect) void;
+ pub const detach = rediwm_glass_detach;
extern fn rediwm_glass_configure(effect: ?*Effect, radius: f32, opacity: f32) void;
pub const configure = rediwm_glass_configure;
};
diff --git a/src/glass_test.c b/src/glass_test.c
index 378b968..576ccff 100644
--- a/src/glass_test.c
+++ b/src/glass_test.c
@@ -82,6 +82,14 @@ static void registry_checks(void)
// Allocation failure leaves nothing behind.
fail_next_glass_allocation = true;
assert(!rediwm_glass_attach(engine, panel, &panel->node, GLASS_PANEL));
+ // A live notification can turn its blur off without removing its card.
+ rediwm_glass_hold(engine, other);
+ rediwm_glass_detach(other);
+ assert(engine->held == NULL && wl_list_empty(&engine->effects));
+ assert(wl_list_length(&scene->tree.children) == 1);
+ other = rediwm_glass_attach(engine, panel, &panel->node, GLASS_PANEL);
+ assert(other && rediwm_glass_effect_info(&other->node->node, &info));
+ assert(info.serial != other_info.serial);
rediwm_glass_destroy(engine);
assert(wl_list_length(&scene->tree.children) == 1); // the panel; its effect went
wlr_scene_node_destroy(&scene->tree.node);
diff --git a/src/notifications/manager.zig b/src/notifications/manager.zig
index 041c43a..a1c638d 100644
--- a/src/notifications/manager.zig
+++ b/src/notifications/manager.zig
@@ -257,6 +257,14 @@ pub const Manager = struct {
return id;
}
+ pub fn themeChanged(self: *Manager) void {
+ for (self.toasts.items) |toast| {
+ toast.buildTree() catch continue;
+ toast.dirty = true;
+ }
+ self.relayoutStack(anim.nowMs());
+ }
+
fn resolveIcon(self: *Manager, toast: *Toast) void {
if (toast.image != null or toast.icon_entry != null or toast.app_icon.len == 0) return;
const output = self.server.getDefaultOutput();
@@ -409,6 +417,7 @@ pub const Manager = struct {
const rx = toast.renderX(now_ms);
const ry = toast.renderY(now_ms);
const op = toast.opacity(now_ms);
+ toast.configureGlass(self.server.glass_engine, if (is_locked) 0 else op);
toast.buffer_node.node.setPosition(@intFromFloat(@round(rx)), @intFromFloat(@round(ry)));
toast.buffer_node.setOpacity(op);
diff --git a/src/notifications/toast.zig b/src/notifications/toast.zig
index 9d7d95c..9378d38 100644
--- a/src/notifications/toast.zig
+++ b/src/notifications/toast.zig
@@ -11,6 +11,7 @@ const scene_data = @import("../scene_data.zig");
const text_mod = @import("ui").text;
const ui = @import("ui");
const theme = @import("ui").theme;
+const glass = @import("../glass.zig");
const icon_service_mod = @import("../icon_service.zig");
const image_mod = @import("image.zig");
@@ -45,6 +46,7 @@ pub const Toast = struct {
icon_entry: ?icon_service_mod.Entry = null,
buffer_node: *wlr.SceneBuffer,
+ glass_effect: ?*glass.Effect = null,
node_data: scene_data.SceneData = undefined,
panel_box: wlr.Box = .{ .x = 0, .y = 0, .width = 0, .height = 0 },
@@ -220,12 +222,12 @@ pub const Toast = struct {
.content = if (toast.summary.len > 0) toast.summary else if (toast.app_name.len > 0) toast.app_name else "Notification",
.font_size = 15,
.weight = 600,
- .color = t.window_fg,
+ .color = t.notification_fg orelse t.window_fg,
} },
.width = .{ .flex = 1 },
};
header[1] = .{
- .kind = .{ .text = .{ .content = "now", .font_size = 11, .color = t.window_dim } },
+ .kind = .{ .text = .{ .content = "now", .font_size = 11, .color = t.notification_dim orelse t.window_dim } },
.width = .{ .fixed = 52 },
};
toast.age_widget = &header[1];
@@ -257,7 +259,7 @@ pub const Toast = struct {
};
for (lines, 0..) |line, i| {
content[i + 1] = .{
- .kind = .{ .text = .{ .content = line, .font_size = 13, .color = t.window_dim } },
+ .kind = .{ .text = .{ .content = line, .font_size = 13, .color = t.notification_dim orelse t.window_dim } },
.width = .{ .percent = 1 },
};
}
@@ -282,7 +284,7 @@ pub const Toast = struct {
}
const root_children = try a.alloc(Widget, 2);
root_children[0] = .{
- .kind = .{ .rect = .{ .color = t.surface, .radius = 10 } },
+ .kind = .{ .rect = .{ .color = t.notification_icon_bg orelse t.surface, .radius = 10 } },
.padding = ui.layout.Edges.all(8),
.width = .{ .fixed = 56 },
.height = .{ .fixed = 56 },
@@ -299,12 +301,12 @@ pub const Toast = struct {
const border_col = if (toast.urgency == 2)
[4]f32{ 0.95, 0.25, 0.25, 0.95 } // Urgent red
else
- t.border;
+ t.notification_border orelse t.border;
toast.root = .{
.kind = .{ .rect = .{
- .color = t.window_bg,
- .radius = 12,
+ .color = t.notification_bg orelse t.window_bg,
+ .radius = t.notification_radius,
.border_width = if (toast.urgency == 2) 2 else 1,
.border_color = border_col,
} },
@@ -359,6 +361,12 @@ pub const Toast = struct {
const buf = PanelBuffer.createUninitialized(pw, ph, scale) catch return;
var renderer = ui.paint.Renderer.init(buf.pixels, buf.width, buf.height, scale);
+ var palette = theme.global;
+ palette.fg = palette.notification_fg orelse palette.fg;
+ palette.dim = palette.notification_dim orelse palette.dim;
+ palette.window_fg = palette.notification_fg orelse palette.window_fg;
+ palette.window_dim = palette.notification_dim orelse palette.window_dim;
+ renderer.palette = palette;
toast.background.paint(allocator, &toast.root, &renderer);
toast.buffer_node.setBuffer(&buf.base);
@@ -367,6 +375,16 @@ pub const Toast = struct {
toast.dirty = false;
}
+ pub fn configureGlass(toast: *Toast, engine: ?*glass.Engine, alpha: f32) void {
+ if (!theme.global.notification_blur) {
+ glass.Effect.detach(toast.glass_effect);
+ toast.glass_effect = null;
+ return;
+ }
+ if (toast.glass_effect == null) toast.glass_effect = glass.Engine.attach(engine, toast.buffer_node, &toast.buffer_node.node, .panel);
+ glass.Effect.configure(toast.glass_effect, theme.global.notification_radius, alpha);
+ }
+
pub fn beginClose(toast: *Toast, now_ms: i64, reason: u32) void {
if (toast.closing) return;
toast.closing = true;
diff --git a/src/notifications_tests.zig b/src/notifications_tests.zig
index 4e6957e..972176d 100644
--- a/src/notifications_tests.zig
+++ b/src/notifications_tests.zig
@@ -33,6 +33,7 @@ test "notifications unit: replaces_id, urgency, DND, lock suppression" {
server.config.notification_rules = &.{};
server.ipc = null;
server.icon_service = null;
+ server.glass_engine = null;
server.output_layout = output_layout;
server.outputs.init();
server.input.cursor = &dummy_cursor;
diff --git a/src/pdf/app.zig b/src/pdf/app.zig
index c015c0e..56fa5a5 100644
--- a/src/pdf/app.zig
+++ b/src/pdf/app.zig
@@ -1702,16 +1702,17 @@ pub const App = struct {
// Top tabs: [ Pages ] [ Outline ]
const tab_w = sb.w / 2.0;
const tab_h = 32.0;
- shell_ui.setSource(cr, if (self.sidebar_tab == .pages) ui_theme.global.app_nav_selected else ui_theme.global.app_item);
+ const idle_tab = if (ui_theme.global.app_sidebar_fg != null) ui_theme.global.app_sidebar else ui_theme.global.app_item;
+ shell_ui.setSource(cr, if (self.sidebar_tab == .pages) ui_theme.global.sidebarSelected() else idle_tab);
c.api.cairo_rectangle(cr, sb.x + 4.0, sb.y + 4.0, tab_w - 6.0, tab_h - 8.0);
c.api.cairo_fill(cr);
- shell_ui.setSource(cr, if (self.sidebar_tab == .outline) ui_theme.global.app_nav_selected else ui_theme.global.app_item);
+ shell_ui.setSource(cr, if (self.sidebar_tab == .outline) ui_theme.global.sidebarSelected() else idle_tab);
c.api.cairo_rectangle(cr, sb.x + tab_w + 2.0, sb.y + 4.0, tab_w - 6.0, tab_h - 8.0);
c.api.cairo_fill(cr);
// The selected tab is told apart by its fill, not by a dimmer label.
- shell_ui.setSource(cr, ui_theme.global.window_fg);
+ shell_ui.setSource(cr, ui_theme.global.sidebarForeground());
shell_ui.drawText(cr, "Pages", sb.x + (tab_w - shell_ui.measureText(cr, "Pages", shell_ui.textSize(), true)) / 2.0, sb.y + 20.0, shell_ui.textSize(), true);
shell_ui.drawText(cr, "Outline", sb.x + tab_w + (tab_w - shell_ui.measureText(cr, "Outline", shell_ui.textSize(), true)) / 2.0, sb.y + 20.0, shell_ui.textSize(), true);
@@ -1806,7 +1807,7 @@ pub const App = struct {
var badge: [16]u8 = undefined;
const badge_str = std.fmt.bufPrint(&badge, "{d}", .{i + 1}) catch "";
const bw = shell_ui.measureText(cr, badge_str, shell_ui.textSize(), is_current);
- shell_ui.setSource(cr, ui_theme.global.window_fg);
+ shell_ui.setSource(cr, ui_theme.global.sidebarForeground());
shell_ui.drawText(cr, badge_str, card_x + (card_w - bw) / 2.0, card_y + card.card_h + 15.0, shell_ui.textSize(), is_current);
}
}
@@ -1814,7 +1815,7 @@ pub const App = struct {
fn renderOutlineList(self: *App, cr: *c.api.cairo_t) void {
const sb = self.sidebarRect();
const items = self.outline orelse {
- shell_ui.setSource(cr, ui_theme.global.window_fg);
+ shell_ui.setSource(cr, ui_theme.global.sidebarForeground());
shell_ui.drawText(cr, "No outline in document", sb.x + 16.0, sb.y + 60.0, shell_ui.textSize(), false);
return;
};
@@ -1826,13 +1827,13 @@ pub const App = struct {
const is_hover = self.hover_outline == idx;
if (is_hover) {
- shell_ui.setSource(cr, ui_theme.global.app_item_hover);
+ shell_ui.setSource(cr, if (ui_theme.global.app_sidebar_fg != null) ui_theme.global.sidebarSelected() else ui_theme.global.app_item_hover);
c.api.cairo_rectangle(cr, sb.x + 4.0, row_y, sb.w - 8.0, row_h);
c.api.cairo_fill(cr);
}
const indent = @as(f64, @floatFromInt(it.level)) * 12.0;
- shell_ui.setSource(cr, ui_theme.global.window_fg);
+ shell_ui.setSource(cr, ui_theme.global.sidebarForeground());
c.api.cairo_save(cr);
c.api.cairo_rectangle(cr, sb.x + 12.0 + indent, row_y, @max(0.0, sb.w - 24.0 - indent), row_h);
c.api.cairo_clip(cr);
diff --git a/src/start_menu/launch.zig b/src/start_menu/launch.zig
index 5460aa2..d0c0dbe 100644
--- a/src/start_menu/launch.zig
+++ b/src/start_menu/launch.zig
@@ -304,6 +304,9 @@ fn launchExec(allocator: Allocator, server: *Server, entry: *const AppEntry, uri
for (argv) |arg| allocator.free(arg);
allocator.free(argv);
}
+ var palette_arena = std.heap.ArenaAllocator.init(allocator);
+ defer palette_arena.deinit();
+ const themed_argv = try @import("config").terminal_theme.wrap(palette_arena.allocator(), server.io, argv, server.config.theme);
const token = server.activation.createToken();
const token_name = if (token) |t| std.mem.span(t.name()) else null;
@@ -329,7 +332,7 @@ fn launchExec(allocator: Allocator, server: *Server, entry: *const AppEntry, uri
const cwd: std.process.Child.Cwd = if (entry.path) |p| (if (p.len > 0) .{ .path = p } else .inherit) else .inherit;
const child = std.process.spawn(server.io, .{
- .argv = argv,
+ .argv = themed_argv,
.environ_map = &env_map,
.cwd = cwd,
}) catch |err| {
@@ -668,11 +671,12 @@ fn launchNewWindowBytes(allocator: Allocator, server: *Server, entry: *const App
defer snapshot.release();
const terminal = @import("../config_runtime/default_apps.zig").find(snapshot.entries, server.config.compositor.default_terminal);
const argv = try buildLaunchArgvUris(a, &live, server.environ, &.{}, terminal);
+ const themed_argv = try @import("config").terminal_theme.wrap(a, server.io, argv, server.config.theme);
var env_map = try server.environ.createMap(a);
defer env_map.deinit();
try server.applyChildEnvWithToken(&env_map, token);
const cwd: std.process.Child.Cwd = if (live.path) |p| (if (p.len > 0) .{ .path = p } else .inherit) else .inherit;
- const child = try std.process.spawn(server.io, .{ .argv = argv, .environ_map = &env_map, .cwd = cwd });
+ const child = try std.process.spawn(server.io, .{ .argv = themed_argv, .environ_map = &env_map, .cwd = cwd });
const pid = child.id orelse return error.SpawnFailed;
server.launch_feedback.begin(.{ .pid = pid, .token = token, .desktop_id = entry.id, .startup_wm_class = entry.startup_wm_class });
app_scope.place(server, pid, trimDesktopSuffix(entry.id));
diff --git a/src/theme_main.zig b/src/theme_main.zig
index 47c3e17..159d94a 100644
--- a/src/theme_main.zig
+++ b/src/theme_main.zig
@@ -11,6 +11,7 @@ extern fn rediwm_theme_pack([*:0]const u8, [*:0]const u8) c_int;
extern fn rediwm_theme_copy([*:0]const u8, [*:0]const u8) c_int;
extern fn rediwm_theme_problem() [*:0]const u8;
extern fn mkdtemp([*:0]u8) ?[*:0]u8;
+extern fn execvp([*:0]const u8, [*:null]const ?[*:0]const u8) c_int;
const a = std.heap.c_allocator;
export fn rediwm_theme_safe_path(path: [*:0]const u8) c_int {
@@ -54,6 +55,27 @@ fn unwrap(io: std.Io, stage: []const u8) ![]const u8 {
if ((try it.next(io)) != null) return error.MultipleArchiveRoots;
return root;
}
+
+fn copyArtwork(io: std.Io, pack: packs.Pack, destination: []const u8) !void {
+ if (pack.root.len == 0) return;
+ // Pack icon/glyph overrides are flat directories. Preserve them when
+ // saving a customised look so its artwork does not silently disappear.
+ for ([_][]const u8{ "icons", "glyphs" }) |folder| {
+ const source = packs.asset(a, io, pack.root, folder) catch |err| switch (err) {
+ error.FileNotFound => continue,
+ else => return err,
+ };
+ var directory = try std.Io.Dir.cwd().openDir(io, source, .{ .iterate = true });
+ defer directory.close(io);
+ var entries = directory.iterate();
+ while (try entries.next(io)) |entry| {
+ const relative = try std.fs.path.join(a, &.{ folder, entry.name });
+ const path = try packs.asset(a, io, pack.root, relative);
+ const target = try std.fs.path.join(a, &.{ destination, relative });
+ try native(rediwm_theme_copy((try z(path)).ptr, (try z(target)).ptr));
+ }
+ }
+}
fn cursorLink(io: std.Io, env: std.process.Environ, p: packs.Pack, destination: []const u8, prepare: bool) !void {
const data = if (env.getPosix("XDG_DATA_HOME")) |d| d else try std.fs.path.join(a, &.{ env.getPosix("HOME") orelse return error.NoHome, ".local/share" });
const icons = try std.fs.path.join(a, &.{ data, "icons" });
@@ -83,6 +105,33 @@ fn run(init: std.process.Init) !void {
if (args.len < 3) return error.Usage;
const verb = std.mem.span(args[1]);
const input = std.mem.span(args[2]);
+ if (std.mem.eql(u8, verb, "terminal")) {
+ if (!std.mem.eql(u8, std.fs.path.basename(input), "foot")) return error.UnsupportedTerminal;
+ var palette: theme.Theme = .{};
+ if (@import("config").path.resolvePath(init.minimal.environ, a)) |path| {
+ if (@import("config").loader.load(path, a, io, init.minimal.environ)) |cfg| palette = cfg.theme else |_| {}
+ } else |_| {}
+ const terminal = @import("config").terminal_theme;
+ const raw = try a.alloc([]const u8, args.len - 2);
+ for (raw, args[2..]) |*dest, arg| dest.* = std.mem.span(arg);
+ var command: []const []const u8 = raw;
+ if (terminal.enabled(palette)) {
+ // Probe an empty config, never the user's. This work happens only
+ // in the short-lived helper, outside the compositor event loop.
+ const probe = std.process.run(a, io, .{
+ .argv = &.{ input, "--check-config", "--config=/dev/null", "--override=colors-dark.foreground=ffffff" },
+ .stdout_limit = .limited(4096),
+ .stderr_limit = .limited(4096),
+ .timeout = .{ .duration = .{ .raw = .fromSeconds(2), .clock = .awake } },
+ }) catch null;
+ const modern = if (probe) |p| p.term == .exited and p.term.exited == 0 else false;
+ command = try terminal.argv(a, raw, palette, modern);
+ }
+ const argv = try a.allocSentinel(?[*:0]const u8, command.len, null);
+ for (argv, command) |*dest, arg| dest.* = (try a.dupeZ(u8, arg)).ptr;
+ _ = execvp(argv[0].?, argv.ptr);
+ return error.TerminalExecFailed;
+ }
if (std.mem.eql(u8, verb, "validate")) {
const p = try validate(io, input, std.fs.path.basename(input));
_ = std.posix.system.write(1, p.id.ptr, p.id.len);
@@ -112,6 +161,7 @@ fn run(init: std.process.Init) !void {
defer cfg.deinit();
if (std.mem.eql(u8, cfg.theme_base, input)) {
changed_config = config_path;
+ try @import("config").setting_save.resetThemeLayout(a, io, config_path);
const dark = try packs.parse(a, @import("ui").theme_presets.bundled[0].bytes, "rediwm-dark", "");
@import("config").loader.replaceThemeOverrides(a, io, config_path, dark.tokens, dark.tokens, "rediwm-dark");
@import("config").loader.replaceTaskbarThemeSection(a, io, config_path, null);
@@ -140,6 +190,7 @@ fn run(init: std.process.Init) !void {
// export <id> <config> <wallpaper> <logo>; asset paths are frozen by caller.
if ((std.mem.eql(u8, verb, "share") and args.len != 7) or (std.mem.eql(u8, verb, "export") and args.len != 6) or !packs.validId(input)) return error.Usage;
const cfg = try @import("config").loader.load(std.mem.span(args[3]), a, io, init.minimal.environ);
+ if (cfg.theme_pack) |pack| try copyArtwork(io, pack, stage);
var t = cfg.theme;
if (std.mem.span(args[5]).len > 0) {
const ext = if (std.ascii.endsWithIgnoreCase(std.mem.span(args[5]), ".svg")) ".svg" else ".png";
@@ -152,6 +203,7 @@ fn run(init: std.process.Init) !void {
try theme.writeInto(a, &bytes, t);
if (std.mem.span(args[5]).len > 0) try bytes.appendSlice(a, if (std.ascii.endsWithIgnoreCase(std.mem.span(args[5]), ".svg")) "start_button_icon = \"logo.svg\"\n" else "start_button_icon = \"logo.png\"\n");
if (cfg.taskbar_theme) |bar| try theme.writeTaskbarInto(a, &bytes, bar);
+ try packs.Layout.write(a, &bytes, cfg.compositor);
try bytes.appendSlice(a, if (cfg.compositor.dark_mode) "[assets]\ncolor_scheme = \"dark\"\n" else "[assets]\ncolor_scheme = \"light\"\n");
if (std.mem.span(args[4]).len > 0) {
const name = std.fs.path.basename(std.mem.span(args[4]));
diff --git a/src/ui/theme.zig b/src/ui/theme.zig
index 113c862..8bc8d7b 100644
--- a/src/ui/theme.zig
+++ b/src/ui/theme.zig
@@ -62,6 +62,44 @@ pub const Theme = struct {
app_git_added: [4]f32 = .{ 34.0 / 255.0, 197.0 / 255.0, 94.0 / 255.0, 1 }, // #22c55e, added lines
app_divider: [4]f32 = .{ 55.0 / 255.0, 63.0 / 255.0, 72.0 / 255.0, 1 }, // #373f48
app_icon: [4]f32 = .{ 214.0 / 255.0, 214.0 / 255.0, 214.0 / 255.0, 1 }, // #d6d6d6, sidebar glyphs
+ /// Client content can be light while compositor decorations stay dark.
+ /// Unset values preserve the existing shared window palette.
+ app_fg: ?[4]f32 = null,
+ app_sidebar_fg: ?[4]f32 = null,
+ app_sidebar_selected: ?[4]f32 = null,
+ app_menu_bg: ?[4]f32 = null,
+ app_field_bg: ?[4]f32 = null,
+ app_field_border: ?[4]f32 = null,
+ dock_bg: ?[4]f32 = null,
+ dock_border: ?[4]f32 = null,
+ dock_radius: f32 = 0, // zero follows the window frame radius
+ notification_bg: ?[4]f32 = null,
+ notification_fg: ?[4]f32 = null,
+ notification_dim: ?[4]f32 = null,
+ notification_border: ?[4]f32 = null,
+ notification_icon_bg: ?[4]f32 = null,
+ notification_radius: f32 = 12,
+ notification_blur: bool = false,
+ // Optional Foot launch palette. Unset entries keep the terminal's config.
+ terminal_bg: ?[4]f32 = null,
+ terminal_fg: ?[4]f32 = null,
+ terminal_cursor: ?[4]f32 = null,
+ terminal_black: ?[4]f32 = null,
+ terminal_red: ?[4]f32 = null,
+ terminal_green: ?[4]f32 = null,
+ terminal_yellow: ?[4]f32 = null,
+ terminal_blue: ?[4]f32 = null,
+ terminal_magenta: ?[4]f32 = null,
+ terminal_cyan: ?[4]f32 = null,
+ terminal_white: ?[4]f32 = null,
+ terminal_bright_black: ?[4]f32 = null,
+ terminal_bright_red: ?[4]f32 = null,
+ terminal_bright_green: ?[4]f32 = null,
+ terminal_bright_yellow: ?[4]f32 = null,
+ terminal_bright_blue: ?[4]f32 = null,
+ terminal_bright_magenta: ?[4]f32 = null,
+ terminal_bright_cyan: ?[4]f32 = null,
+ terminal_bright_white: ?[4]f32 = null,
scrollbar_thumb: [4]f32 = .{ 89.0 / 255.0, 98.0 / 255.0, 110.0 / 255.0, 1 }, // #59626e
/// Unset follows the surface accent during hover/drag.
scrollbar_thumb_active: ?[4]f32 = null,
@@ -298,6 +336,26 @@ pub const Theme = struct {
return t.caret orelse t.accent;
}
+ /// Resolve once in standalone clients, keeping every shared widget and
+ /// Cairo text caller on the same effective foreground and field palette.
+ pub fn forApp(t: Theme) Theme {
+ var result = t;
+ result.window_fg = t.app_fg orelse t.window_fg;
+ result.window_dim = t.app_fg orelse t.window_dim;
+ result.window_bg = t.app_menu_bg orelse t.window_bg;
+ result.field_bg = t.app_field_bg orelse t.field_bg;
+ result.field_border = t.app_field_border orelse t.field_border;
+ return result;
+ }
+
+ pub fn sidebarForeground(t: Theme) [4]f32 {
+ return t.app_sidebar_fg orelse t.window_fg;
+ }
+
+ pub fn sidebarSelected(t: Theme) [4]f32 {
+ return t.app_sidebar_selected orelse t.app_nav_selected;
+ }
+
pub fn controlFocusColor(t: Theme) [4]f32 {
return t.shell_border_focus orelse t.fg;
}
diff --git a/src/ui/theme_presets.zig b/src/ui/theme_presets.zig
index 967b6e3..a75f3d7 100644
--- a/src/ui/theme_presets.zig
+++ b/src/ui/theme_presets.zig
@@ -12,4 +12,5 @@ pub const bundled = [_]Preset{
.{ .id = "rediwm-light", .name = "RediWM Light", .bytes = @embedFile("theme-rediwm-light") },
.{ .id = "redi-blue", .name = "Redi Blue", .bytes = @embedFile("theme-redi-blue") },
.{ .id = "redi-mocha", .name = "Redi-Mocha", .bytes = @embedFile("theme-redi-mocha") },
+ .{ .id = "gold", .name = "Gold", .bytes = @embedFile("theme-gold") },
};
diff --git a/tests/notifications.py b/tests/notifications.py
index 5b43db3..310f9a8 100644
--- a/tests/notifications.py
+++ b/tests/notifications.py
@@ -318,6 +318,14 @@ dnd_bypass = true
"folder-download", "Download Complete",
"ubuntu-24.04.iso has finished downloading.", 0, 0, 0)
time.sleep(0.35) # entrance/reflow settled
+ # A live card adopts Gold's separate palette and glass, then drops
+ # its effect when switched back. It remains the same notification.
+ live_id = ipc.get_notifications()["toasts"][0]["id"]
+ for theme_id in ("gold", "rediwm-dark"):
+ ipc.action("theme.apply", {"id": theme_id})
+ ipc.wait_for_frame()
+ assert ipc.get_notifications()["toasts"][0]["id"] == live_id
+ time.sleep(0.35) # the taskbar edge change also reflows the card
output = ipc.get_outputs()[0]
preview = os.environ.get("REDIWM_NOTIFICATION_PREVIEW")
if preview:
diff --git a/tests/theme_packs.py b/tests/theme_packs.py
index 6d11683..475ab63 100644
--- a/tests/theme_packs.py
+++ b/tests/theme_packs.py
@@ -105,7 +105,7 @@ def run():
try:
with IPCClient(tmp, timeout=30) as ipc:
before = ipc.query("theme.list")
- assert {p["id"] for p in before["packs"]} >= {"rediwm-dark", "rediwm-light", "redi-blue", "redi-mocha"}
+ assert {p["id"] for p in before["packs"]} >= {"rediwm-dark", "rediwm-light", "redi-blue", "redi-mocha", "gold"}
mocha = next(p for p in before["packs"] if p["id"] == "redi-mocha")
assert mocha["name"] == "Redi-Mocha" and not mocha["user_installed"], mocha
ipc.action("theme.apply", {"id": "redi-mocha"})
@@ -117,6 +117,37 @@ def run():
assert all(abs(a - b) < .001 for a, b in zip(look["tokens"][key], expected)), key
wait_for(lambda: (ipc.query("get_wallpaper")["displayed_path"] or "").endswith("/wallpaper-mocha.png"), "Mocha wallpaper was not presented")
assert tomllib.loads((tmp / "rediwm-config.toml").read_text())["theme"] == {"base": "redi-mocha"}
+ # Gold is a complete installed pack, including layout defaults.
+ ipc.action("theme.apply", {"id": "gold"})
+ gold = ipc.action("get_theme")
+ assert gold["tokens"]["notification_blur"] is True
+ assert gold["tokens"]["app_fg"] != gold["tokens"]["window_fg"]
+ wait_for(lambda: UIDriver(ipc).widgets("dock"), "Gold dock did not appear")
+ assert ipc.get_shell_state()["taskbars"][0]["box"]["y"] == 0
+ assert UIDriver(ipc).widgets("dock")[0]["global_box"]["height"] == 76
+ wait_for(lambda: (ipc.query("get_wallpaper")["displayed_path"] or "").endswith("/wallpaper-gold.png"), "Gold wallpaper was not presented")
+ cfg = tomllib.loads((tmp / "rediwm-config.toml").read_text())
+ assert not {"dock_enabled", "dock_height", "taskbar_position"} & cfg["compositor"].keys()
+ if shutil.which("foot"):
+ helper(dict(env, REDIWM_CONFIG=str(tmp / "rediwm-config.toml")), "terminal", "foot", "--check-config", "--config=/dev/null")
+ config_path = tmp / "rediwm-config.toml"
+ config_path.write_text(config_path.read_text().replace("[compositor]", '[compositor]\ndock_enabled = false\ntaskbar_position = "bottom"\ndock_height = 48', 1))
+ wait_for(lambda: not UIDriver(ipc).widgets("dock"), "explicit dock override did not win")
+ assert ipc.get_shell_state()["taskbars"][0]["box"]["y"] > 0
+ ipc.action("theme.apply", {"id": "gold"})
+ wait_for(lambda: UIDriver(ipc).widgets("dock"), "reset did not restore Gold layout")
+ assert not {"dock_enabled", "dock_height", "taskbar_position"} & tomllib.loads(config_path.read_text())["compositor"].keys()
+ # Every other bundled theme restores the standard bar and no dock.
+ for theme_id in ("rediwm-dark", "rediwm-light", "redi-blue", "redi-mocha"):
+ ipc.action("theme.apply", {"id": "gold"})
+ wait_for(lambda: UIDriver(ipc).widgets("dock"), "Gold dock did not appear")
+ ipc.action("theme.apply", {"id": theme_id})
+ wait_for(lambda: not UIDriver(ipc).widgets("dock"), f"Gold dock layout leaked into {theme_id}")
+ assert ipc.action("get_theme")["tokens"]["taskbar_size"] == 44, theme_id
+ bar = ipc.get_shell_state()["taskbars"][0]["box"]
+ output = ipc.get_outputs()[0]
+ assert bar["height"] == 44, (theme_id, bar)
+ assert bar["y"] == output["y"] + output["logical_height"] - 44, (theme_id, bar)
installed = ipc.action("theme.install", {"path": str(archive)})
assert installed["id"] == "test-pack", installed
try:
@@ -162,6 +193,16 @@ def run():
pixels = Image.open(files_shot).convert("RGB").crop((box["x"], box["y"], box["x"] + box["width"], box["y"] + box["height"]))
return any(color == PINK for color in pixels.getdata())
wait_for(files_has_folder, "Files did not use pack folder icon")
+ ipc.action("theme.apply", {"id": "gold"})
+ def files_has_gold_palette():
+ files_shot.unlink(missing_ok=True)
+ ipc.screenshot(str(files_shot))
+ with Image.open(files_shot) as image:
+ colors = dict((color, count) for count, color in image.convert("RGB").getcolors(image.width * image.height))
+ return colors.get((238, 230, 219), 0) > 5000 and colors.get((57, 51, 46), 0) > 100 and colors.get((241, 231, 219), 0) > 100
+ wait_for(files_has_gold_palette, "Gold app, sidebar and chrome foregrounds were not separated")
+ ipc.action("theme.apply", {"id": "test-pack"})
+ wait_for(files_has_folder, "Files did not restore pack icons after Gold")
ipc.action("set_accent_color", {"color": "#112233"})
cfg = tomllib.loads((tmp / "rediwm-config.toml").read_text())
assert set(cfg["theme"]) == {"base", "accent"}, cfg["theme"]
@@ -179,6 +220,8 @@ def run():
helper(export_env, "share", "exported", tmp / "rediwm-config.toml", tmp / "data/rediwm/themes/test-pack/wallpapers/test.png", tmp / "data/rediwm/themes/test-pack/logo.svg", exported)
assert exported.is_file()
helper(env, "validate", tmp / "data/rediwm/themes/exported")
+ assert (tmp / "data/rediwm/themes/exported/icons/folder.svg").read_bytes() == (pack / "icons/folder.svg").read_bytes()
+ assert (tmp / "data/rediwm/themes/exported/glyphs/wifi.svg").read_bytes() == (pack / "glyphs/wifi.svg").read_bytes()
helper(env, "remove", "exported")
ipc.action("theme.apply", {"id": "test-pack"})
assert tomllib.loads((tmp / "rediwm-config.toml").read_text())["theme"] == {"base": "test-pack"}