Settings module: the wallpaper chooser moves in, and a Dark mode switch
CI / test (push) Failing after 16s

- The session settings module becomes the panel's "Settings" button. Its popup lists the session
  switches, then a "Wallpaper" heading and the wallpapers (current one ticked); a click on a
  wallpaper shows it at once, as the old chooser did. Up/Down skip the heading.
- The standalone wallpaper module and its world are removed. A saved panel.edn that lists
  "wallpaper" gets the settings module in its place (or just drops it when Settings is there).
- New "Dark mode" setting (on by default). Off swaps the compositor to the Moon Day palette
  (ThemeTokens::moon_day, the values of config/themes/moon-day.json) for the shell, panel modules,
  window decorations and the switcher; on goes back to the configured theme. Saved in state.edn
  as :theme :light (absent or :dark: dark) and applied at startup by restore_state.
- Tests: the native wallpaper test drives the settings module, the settings test flips Dark mode
  and checks the theme, the state.edn round trip covers :theme, panel migration unit test, and
  the host-wasm test covers the switches and the wallpaper rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hgxf6exeYrDGcy4WW3
This commit is contained in:
Claude committed 2026-11-25 18:46:25 +00:00
1 parent a0b878af23
commit ee019ecbaa
26 files changed
+295 -878

No files matched your search

+15 -1
View File
@@ -32,7 +32,9 @@ pub(all) struct ChandraCompositor {
popups : Array[HostPopup]
server : @wayland.WaylandServer
wm : @wm.WmState
theme : @scene.ThemeTokens
/// The theme in use: `dark_theme` (the configured one) or Moon Day, per the Dark mode setting.
mut theme : @scene.ThemeTokens
dark_theme : @scene.ThemeTokens
mut output_w : Int
mut output_h : Int
mut work_area : @wm.Rect
@@ -108,6 +110,7 @@ pub fn ChandraCompositor::new(
server,
wm,
theme,
dark_theme: theme,
output_w,
output_h,
work_area,
@@ -440,6 +443,7 @@ pub fn ChandraCompositor::set_layout_mode(
pub fn ChandraCompositor::restore_state(self : ChandraCompositor) -> Unit {
let st = self.shell.load_state()
self.shell.apply_state(st)
self.apply_theme()
match st.layout {
Some(0) => self.set_layout_mode(@wm.LayoutMode::Tiling)
Some(1) => self.set_layout_mode(@wm.LayoutMode::Monocle)
@@ -963,12 +967,22 @@ fn ChandraCompositor::activate_task(self : ChandraCompositor, wid : UInt64) -> U
)
}
///| Use the dark (configured) or the light theme, as the shell's Dark mode setting says, for the
/// shell, the panel modules, the window decorations and the switcher; redraws everything.
pub fn ChandraCompositor::apply_theme(self : ChandraCompositor) -> Unit {
let t = if self.shell.dark_mode { self.dark_theme } else { @scene.ThemeTokens::moon_day() }
self.theme = t
self.shell.set_output(t, self.output_w, self.output_h)
self.damage.mark_full()
}
///| Carry out what panel modules asked for: focus a window, switch layout.
fn ChandraCompositor::run_shell_actions(self : ChandraCompositor) -> Unit {
for a in self.shell.take_actions() {
match a {
@shell.ShellAction::FocusWindow(wid) => self.activate_task(wid)
@shell.ShellAction::Logout => self.quit_requested = true
@shell.ShellAction::ThemeChanged => self.apply_theme()
@shell.ShellAction::SetLayout(m) =>
match m {
0 => self.set_layout_mode(@wm.LayoutMode::Tiling)