feat(desktop): default DMS theme color to Auto
Some checks are pending
ci / test (push) Waiting to run

This commit is contained in:
Phoebus 2026-10-02 03:07:12 -07:00
parent 318996df56
commit 8a2fce5b18
5 changed files with 81 additions and 0 deletions

View file

@ -5,6 +5,12 @@ this file is the curated, human-readable summary.
## Unreleased — Fast defaults with user-controlled source builds ## Unreleased — Fast defaults with user-controlled source builds
- **Automatic wallpaper colors by default (2026-10-02).** New DMS profiles
select Theme Color → Auto, deriving their accent from the bundled wallpaper
when matugen is installed.
The session fills a missing theme choice in an existing settings file without
changing other settings, and preserves an explicitly chosen theme.
- **First-login wallpaper and profile initials (2026-10-02).** Mango now seeds - **First-login wallpaper and profile initials (2026-10-02).** Mango now seeds
DMS's wallpaper session state with `~/Pictures/Wallpapers/aurora-lagoon.jpg` DMS's wallpaper session state with `~/Pictures/Wallpapers/aurora-lagoon.jpg`
and opens the wallpaper browser in that folder, including on the live and opens the wallpaper browser in that folder, including on the live

View file

@ -3,6 +3,16 @@
Rolling note between work sessions. **Update this file before you finish**, then Rolling note between work sessions. **Update this file before you finish**, then
commit it. It should be short and current; use `git log` for detail. commit it. It should be short and current; use `git log` for detail.
- **Theme Color Auto default (2026-10-02):** DMS 1.6.2 maps the Theme Color
Auto button to `currentThemeName=dynamic` and
`currentThemeCategory=dynamic` in `settings.json`. The Mango session now
seeds those values before shell startup when the bundled aurora is present
and no theme was chosen, preserving other settings and explicit themes.
Session tests cover all three cases; `make check`, release/static builds and
ShellCheck pass. The running disposable VM visibly has Auto selected with
the aurora wallpaper; the new first-login seed itself awaits a fresh ISO.
The host has 10 GiB free against the 20 GiB VM gate.
- **Wallpaper and avatar defaults (2026-10-02):** The Mango session sets - **Wallpaper and avatar defaults (2026-10-02):** The Mango session sets
DMS's `session.json` wallpaper path to the bundled aurora only when unset, DMS's `session.json` wallpaper path to the bundled aurora only when unset,
and its `cache.json` wallpaper browser folder to and its `cache.json` wallpaper browser folder to

View file

@ -48,6 +48,17 @@ disposable VM; `serial-driver.py recovery` now automates the same check.
## Matrix ## Matrix
Theme color default (2026-10-02): the Mango session seeds DMS 1.6.2's
`currentThemeName` and `currentThemeCategory` as `dynamic` before DMS starts,
when the aurora wallpaper is present and no theme choice exists. This is the
Theme Color → Auto option. Existing theme choices are retained. Functional
session tests cover first use, a missing theme field beside another setting,
and preservation of a chosen theme. `make check`, release/static builds and
ShellCheck pass. The running disposable VM already displays Auto selected with
the aurora wallpaper; this is visual evidence of the option, not of the new
first-login seed. A fresh ISO/install with this default has not been VM-verified
because the host has 10 GiB free against the 20 GiB VM gate.
First-login appearance (2026-10-02): the existing disposable VM shows the First-login appearance (2026-10-02): the existing disposable VM shows the
bundled `aurora-lagoon.jpg` and a first-letter profile avatar. The session bundled `aurora-lagoon.jpg` and a first-letter profile avatar. The session
launcher now seeds DMS's wallpaper path and wallpaper browser directory only launcher now seeds DMS's wallpaper path and wallpaper browser directory only

View file

@ -1492,6 +1492,22 @@ default_wallpaper="$wallpaper_dir/aurora-lagoon.jpg"
if [ -r "$default_wallpaper" ] && command -v jq >/dev/null 2>&1; then if [ -r "$default_wallpaper" ] && command -v jq >/dev/null 2>&1; then
( (
umask 077 umask 077
# DMS Theme Color > Auto derives the accent from the wallpaper. Set
# this only for a new profile (or one with no theme choice).
dms_settings="${XDG_CONFIG_HOME:-$HOME/.config}/DankMaterialShell/settings.json"
if mkdir -p "$(dirname "$dms_settings")"; then
if [ ! -e "$dms_settings" ]; then
jq -n '{configVersion:18,currentThemeName:"dynamic",currentThemeCategory:"dynamic"}' > "$dms_settings"
elif jq -e '(.currentThemeName // "") == ""' "$dms_settings" >/dev/null 2>&1; then
if settings_tmp="$(mktemp "${dms_settings}.XXXXXX")"; then
if jq '.currentThemeName = "dynamic" | .currentThemeCategory = "dynamic"' "$dms_settings" > "$settings_tmp"; then
mv "$settings_tmp" "$dms_settings"
else
rm -f "$settings_tmp"
fi
fi
fi
fi
dms_state="$HOME/.local/state/DankMaterialShell/session.json" dms_state="$HOME/.local/state/DankMaterialShell/session.json"
dms_cache="$HOME/.cache/DankMaterialShell/cache.json" dms_cache="$HOME/.cache/DankMaterialShell/cache.json"
if mkdir -p "$(dirname "$dms_state")" "$(dirname "$dms_cache")"; then if mkdir -p "$(dirname "$dms_state")" "$(dirname "$dms_cache")"; then

View file

@ -168,10 +168,18 @@ fn first_login_seeds_wallpaper_folder_and_letter_avatar_without_replacing_choice
.path() .path()
.join(".cache/DankMaterialShell/cache.json"); .join(".cache/DankMaterialShell/cache.json");
let avatar = fixture.dir.path().join(".face"); let avatar = fixture.dir.path().join(".face");
let settings = fixture
.dir
.path()
.join(".config/DankMaterialShell/settings.json");
let state_json: serde_json::Value = let state_json: serde_json::Value =
serde_json::from_slice(&std::fs::read(&state).unwrap()).unwrap(); serde_json::from_slice(&std::fs::read(&state).unwrap()).unwrap();
let cache_json: serde_json::Value = let cache_json: serde_json::Value =
serde_json::from_slice(&std::fs::read(&cache).unwrap()).unwrap(); serde_json::from_slice(&std::fs::read(&cache).unwrap()).unwrap();
let settings_json: serde_json::Value =
serde_json::from_slice(&std::fs::read(&settings).unwrap()).unwrap();
assert_eq!(settings_json["currentThemeName"], "dynamic");
assert_eq!(settings_json["currentThemeCategory"], "dynamic");
assert_eq!( assert_eq!(
state_json["wallpaperPath"], state_json["wallpaperPath"],
wallpapers wallpapers
@ -198,6 +206,11 @@ fn first_login_seeds_wallpaper_folder_and_letter_avatar_without_replacing_choice
.unwrap(); .unwrap();
std::fs::write(&cache, "{\"configVersion\":3,\"wallpaperLastPath\":\"/chosen\",\"fileBrowserSettings\":{\"wallpaper\":{\"lastPath\":\"/chosen\"}}}").unwrap(); std::fs::write(&cache, "{\"configVersion\":3,\"wallpaperLastPath\":\"/chosen\",\"fileBrowserSettings\":{\"wallpaper\":{\"lastPath\":\"/chosen\"}}}").unwrap();
std::fs::write(&avatar, b"custom avatar").unwrap(); std::fs::write(&avatar, b"custom avatar").unwrap();
std::fs::write(
&settings,
r#"{"configVersion":18,"currentThemeName":"purple","currentThemeCategory":"generic"}"#,
)
.unwrap();
std::fs::remove_file(fixture.runtime.join("wayland-0")).unwrap(); std::fs::remove_file(fixture.runtime.join("wayland-0")).unwrap();
let (status, stderr) = fixture.run(); let (status, stderr) = fixture.run();
@ -209,4 +222,29 @@ fn first_login_seeds_wallpaper_folder_and_letter_avatar_without_replacing_choice
.read(".cache/DankMaterialShell/cache.json") .read(".cache/DankMaterialShell/cache.json")
.contains("/chosen")); .contains("/chosen"));
assert_eq!(std::fs::read(&avatar).unwrap(), b"custom avatar"); assert_eq!(std::fs::read(&avatar).unwrap(), b"custom avatar");
assert!(fixture
.read(".config/DankMaterialShell/settings.json")
.contains("purple"));
}
#[test]
fn missing_theme_choice_is_filled_without_losing_other_dms_settings() {
let fixture = Fixture::new(MANGO_OK);
let wallpapers = fixture.dir.path().join("Pictures/Wallpapers");
std::fs::create_dir_all(&wallpapers).unwrap();
std::fs::write(wallpapers.join("aurora-lagoon.jpg"), b"sample image").unwrap();
let settings = fixture
.dir
.path()
.join(".config/DankMaterialShell/settings.json");
std::fs::create_dir_all(settings.parent().unwrap()).unwrap();
std::fs::write(&settings, r#"{"configVersion":18,"fontSize":15}"#).unwrap();
let (status, stderr) = fixture.run();
assert!(status.success(), "session failed: {stderr}");
let saved: serde_json::Value =
serde_json::from_slice(&std::fs::read(settings).unwrap()).unwrap();
assert_eq!(saved["currentThemeName"], "dynamic");
assert_eq!(saved["currentThemeCategory"], "dynamic");
assert_eq!(saved["fontSize"], 15);
} }