Settings module: the wallpaper chooser moves in, and a Dark mode switch
CI / test (push) Failing after 16s
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:
26 files changed
+295
-878
No files matched your search
@@ -5,7 +5,8 @@
|
||||
/// :recent ["foot" "dolphin"] ; the launcher's recently started apps, newest first
|
||||
/// :windows {"foot" {:x 80 :y 60 :w 640 :h 480}} ; floating windows' last place, by app id
|
||||
/// :desktop-card {:x 900 :y 24} ; where the desktop card was dragged to (absent: default spot)
|
||||
/// :wallpaper :aurora ; the wallpaper module's choice (absent: :plasma-glow)
|
||||
/// :wallpaper :aurora ; the settings module's wallpaper (absent: :plasma-glow)
|
||||
/// :theme :light ; the settings module's Dark mode switch is off (absent: dark)
|
||||
/// :session [{:app "foot"} {:app "org.gnome.Nautilus" :minimized true}]
|
||||
/// ; the windows open when the last session ended, reopened at
|
||||
/// ; the next start (see session.mbt in compositor/host)
|
||||
@@ -31,6 +32,8 @@ pub(all) struct SavedState {
|
||||
/// Session settings; None when the file doesn't say (both default to on).
|
||||
restore_session : Bool?
|
||||
remember_windows : Bool?
|
||||
/// From `:theme`: true for :dark, false for :light.
|
||||
dark_mode : Bool?
|
||||
}
|
||||
|
||||
///|
|
||||
@@ -44,6 +47,7 @@ let layout_names : Array[String] = ["tiling", "monocle", "floating"]
|
||||
///| The keys this build owns; everything else in the file is kept as it is.
|
||||
let owned_keys : Array[String] = [
|
||||
"layout", "recent", "desktop-card", "windows", "wallpaper", "restore-session", "remember-windows",
|
||||
"theme",
|
||||
]
|
||||
|
||||
///| How state.edn names each wallpaper, in `@libshell.wallpaper_names` order.
|
||||
@@ -87,6 +91,7 @@ pub fn DesktopShell::load_state(self : DesktopShell) -> SavedState {
|
||||
wallpaper: None,
|
||||
restore_session: None,
|
||||
remember_windows: None,
|
||||
dark_mode: None,
|
||||
}
|
||||
}
|
||||
let entries = read_state_file()
|
||||
@@ -186,6 +191,11 @@ pub fn DesktopShell::load_state(self : DesktopShell) -> SavedState {
|
||||
wallpaper,
|
||||
restore_session: flag("restore-session"),
|
||||
remember_windows: flag("remember-windows"),
|
||||
dark_mode: match lookup_key(entries, "theme") {
|
||||
Some(Keyword("light")) => Some(false)
|
||||
Some(Keyword("dark")) => Some(true)
|
||||
_ => None
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +216,10 @@ pub fn DesktopShell::apply_state(self : DesktopShell, st : SavedState) -> Unit {
|
||||
Some(b) => self.remember_windows = b
|
||||
None => ()
|
||||
}
|
||||
match st.dark_mode {
|
||||
Some(b) => self.dark_mode = b
|
||||
None => ()
|
||||
}
|
||||
match st.desk {
|
||||
Some((x, y)) => {
|
||||
self.desk_set = true
|
||||
@@ -278,6 +292,9 @@ pub fn DesktopShell::save_state(self : DesktopShell) -> Unit {
|
||||
entries.insert(2, (@edn.Value::Keyword("wallpaper"), @edn.Value::Keyword(wallpaper_keys[self.wallpaper_sel])))
|
||||
}
|
||||
// Session settings are written only when off: absent means on, as for a hand-written file.
|
||||
if !self.dark_mode {
|
||||
entries.insert(2, (@edn.Value::Keyword("theme"), @edn.Value::Keyword("light")))
|
||||
}
|
||||
if !self.remember_windows {
|
||||
entries.insert(2, (@edn.Value::Keyword("remember-windows"), @edn.Value::Bool(false)))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user