fix(wallpaper): support matugen 4.x and TTY-less invocation#39
Open
wendeus0 wants to merge 1 commit into
Open
Conversation
…tion
Two related bugs prevented theme regeneration when running with
matugen >= 4.x (current Arch Extra version):
1. matugen requires `--prefer` when multiple source colors can be
extracted from an image and there is no TTY, which is always the
case under `exec_sh_async`. Without it, the subprocess aborts
silently. The user_settings JSON is updated, but the SCSS / GTK /
Qt color files stay stale, so the next reload shows the previous
palette and the toggle appears broken.
2. matugen 4.x changed the JSON shape of `--json hex` from raw hex
strings to `{"color": "#hex"}` dicts. `generatePreviews()` writes
`color_value` straight into preview-colors.scss, which now produces
invalid SCSS like
$palette-content-background: {'color': '#fcfaec'};
This crashes Sass compilation on `ignis reload` and the shell
silently dies (no stylesheet -> no UI).
This patch:
- Adds `--prefer saturation` to all 8 `matugen image` invocations
(3 in `setWall`, 3 in `setColors`/`setDarkMode`, 2 in
`generatePreviews`). Saturation matches the visual intent of the
selected scheme without UI input.
- In `generatePreviews()`, unboxes `color_value` when it is a dict
by reading `color`/`hex` keys (matugen 4.x) and falls back to the
first value otherwise. Backwards compatible with matugen-bin 3.x
and matugen-git, which already returned strings.
Closes debuggyo#37
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes theme regeneration on systems with matugen >= 4.x (current Arch Extra version). Two related bugs prevent the appearance toggle (Light/Dark, color schemes, wallpaper) from updating any color file — the
user_settings.jsonis saved correctly but every downstream stylesheet stays stale, and on the nextignis reloadthe shell may crash entirely.Closes #37
Root cause
1. Missing
--preferflagMatugen 4.x requires
--prefer <strategy>when an image has multiple extractable source colors and no TTY is attached.exec_sh_asyncnever has a TTY, so everymatugen imageinvocation aborts with:The
asyncio.create_taskswallows this silently, so from the user's perspective the toggle "does nothing".2.
--json hexoutput shape changedMatugen 4.x emits
{"colors": {"background": {"light": {"color": "#fcfaec"}, "dark": {"color": "#11150c"}}}}instead of the previous flat
"#fcfaec"strings.generatePreviews()writescolor_valuestraight intopreview-colors.scss, producing invalid SCSS likeSass compilation fails, the stylesheet pipeline dies, and on the next reload the Ignis shell renders without any CSS (Material Symbols become literal text labels, cards lose their background).
Changes
matugen imageinvocations--prefer saturation(matches visual intent of the selected scheme without UI input)generatePreviews()color_valuewhen it is a dict, readingcolor/hex/ first-value-fallbackBackwards compatible: the dict unbox only triggers when
isinstance(color_value, dict)is true, so matugen-bin 3.x and matugen-git (which already returned strings) keep working.Test plan
matugen-bin 4.1.0: confirmed toggle was a no-op andignis reloadcrashed Ignis withExpected expressionfrompreview-colors.scssmatugen image -t scheme-expressive '<wallpaper>' -m light --prefer saturationmanually —~/.config/ignis/colors.scss,~/.config/gtk-3.0/colors.css,~/.config/gtk-4.0/colors.css,~/.config/qt5ct/colors/matugen.conf,~/.config/qt6ct/colors/matugen.confall regenerate cleanlypreview-colors.scssnow contains valid SCSS ($palette-content-background: #fcfaec;)ignis reloadsucceeds; Light/Dark toggle applies in real time; color scheme bolinhos update paletteisinstanceguard for compat — would appreciate a second pair of eyes here)Notes for reviewer
--prefer saturationis a heuristic choice. If you'd rather expose this as a setting (user_settings.appearance.wallcolors.prefer), happy to push a follow-up.setDarkMode/setColorsflow doesn't read JSON output, only triggers matugen and lets the templates do their thing — so the existing template files do not need changes.🤖 Generated with Claude Code