[BUG] run_matugen() regenerates the whole palette in light mode when gtk-application-prefer-dark-theme is 'true' instead of '1'
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- bash, linux
- Lĩnh vực
- backend
Hướng nghiên cứu
Đọc .config/ml4w/scripts/ml4w-wallpaper, đặc biệt là run_matugen() quanh phần kiểm tra tùy chọn GTK ở dòng 109–113, rồi so sánh cách xử lý với hai script được nêu trong issue. Cập nhật phần kiểm tra để cả 1 và true đều chọn chế độ tối, còn 0 và false chọn chế độ sáng. Hoàn thành khi cả bốn giá trị đều tạo ra chế độ như mong đợi mà không có stderr, như mô tả trong issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
run_matugen() in .config/ml4w/scripts/ml4w-wallpaper decides between light and dark mode with a numeric comparison against gtk-application-prefer-dark-theme:
theme_pref=$(grep -E '^gtk-application-prefer-dark-theme=' "$HOME/.config/gtk-3.0/settings.ini" | awk -F'=' '{print $2}')
local mode="light"
[ "$theme_pref" -eq 1 ] && mode="dark"
gtk-application-prefer-dark-theme is a GTK boolean, so true/false is an equally valid spelling of 1/0. When the key holds true, [ -eq ] fails:
$ theme_pref="true"; [ "$theme_pref" -eq 1 ] && mode="dark"
bash: line 1: [: true: integer expected
The && chain short-circuits, mode keeps its default light, and matugen regenerates the entire palette in light mode — waybar, window borders, GTK, rofi, swaync, btop, kitty, nwg-dock and the quickshell components all go light on a dark setup. With wallpaper automation enabled it happens unattended, so it looks like an update silently changed the theme.
This is an internal inconsistency, not a missing feature. Two other consumers of the same key in this repo already accept both spellings:
.config/ml4w/listeners/gtk-theme-switcher.sh— line 49 handles1/trueand0/falseexplicitly, and even warns on unexpected values:if [[ "$THEME_PREF" == "1" || "$THEME_PREF" == "true" ]]; then.config/hypr/scripts/gtk.sh— line 28 treats only0/falseas light:if [[ $prefer_dark_theme == "0" || $prefer_dark_theme == "false" ]]; then
So of the three places that read this key, only run_matugen() was left with the numeric test.
The dotfiles ship gtk-application-prefer-dark-theme=1, which is why this doesn't show on a clean install. It surfaces once any third-party GTK settings tool normalizes settings.ini to the boolean spelling.
Steps to reproduce
On my machine the key was flipped to true by kde-gtk-config, which is part of the default CachyOS package set even in a Hyprland session. It rewrote ~/.config/gtk-3.0/settings.ini and ~/.config/gtk-4.0/settings.ini into KDE's format — both files and ~/.config/xsettingsd/xsettingsd.conf share the same mtime to the second, and the values it left behind are KDE's (breeze, breeze_cursors, ocean). I did not determine what invoked it, so I can't give exact steps for that part.
The bug itself is independent of that trigger and can be reproduced directly:
- Confirm the current palette is dark:
grep '"background"' ~/.config/ml4w/colors/colors.json - Set the key to its boolean spelling:
sed -i 's/^gtk-application-prefer-dark-theme=1/gtk-application-prefer-dark-theme=true/' ~/.config/gtk-3.0/settings.ini - Re-run the wallpaper script:
~/.config/ml4w/scripts/ml4w-wallpaper "$(cat ~/.cache/ml4w/hyprland-dotfiles/current_wallpaper)" - It logs
Running matugen in light mode, andcolors.jsoncomes back light ("background": "#faf8ff"on my source wallpaper, vs#121318before).
Expected behavior
run_matugen() should treat true the same as 1, consistently with gtk-theme-switcher.sh and gtk.sh, and keep generating a dark palette.
A one-line change is enough:
case "$theme_pref" in 1 | true) mode="dark" ;; esac
I verified this against all four values: 1 → dark, true → dark, 0 → light, false → light, with no stderr output. After applying it, the script logs Running matugen in dark mode and the palette returns to its previous values.
Screenshots
No response
Distribution
Other (please specify below)
If Other, specify
CachyOS (Arch-based), ML4W OS 2.12.3, Hyprland 0.56.1
Additional context
There is a second-order effect worth flagging: while the key holds true, .config/ml4w/scripts/ml4w-toggle-theme cannot switch modes either. It tests grep -q "gtk-application-prefer-dark-theme=1", does not match true, falls through to the else branch, and runs sed 's/gtk-application-prefer-dark-theme=0/...=1/', which does not match either. It prints Switched to dark theme while leaving the GTK3 file unchanged — so the user cannot correct the state from the UI, which is what makes the palette change feel permanent.
I searched open and closed issues before reporting (prefer-dark-theme, matugen, light theme, run_matugen, settings.ini, kde-gtk-config) and did not find this. #1596 looked close but is the opposite direction and was fixed in 2.13.0.
I have no strong preference on the fix; the case above is just the smallest change that matches what the other two scripts already do. Happy to open a PR if that helps.
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- QML
- Star
- 5.1k
- Fork
- 386
- Merge trung bình
- 16 giờ 45 phút
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mylinuxforwork/dotfiles
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mylinuxforwork/dotfiles#1904 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
mylinuxforwork/dotfiles#1829 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement solved
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
mylinuxforwork/dotfiles#1807 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE] add keycap 1 app window over all windowsCó thể đã có người làm @mylinuxforwork đã nhận 1 ngày trước. Đang mởenhancement
mylinuxforwork/dotfiles#1902 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Install Fails on Debian Testing & UnstableCó thể đã có người làm @mylinuxforwork đã nhận 11 ngày trước. Đang mởbug
mylinuxforwork/dotfiles#1898 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của mylinuxforwork/dotfiles
Issue tương tự
-
In-box secret files written before their chmod: lc-creds, stacks tee, and the workspace tokenĐang mởmodel:sonnet runtime:claude security size:S
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
FootprintAI/Containarium#3671 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
HolidayBase: reassigning `language` does not re-initialize translations or re-populate holidaysCó thể đã có người làm @shikhabhadoria đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vacanza/holidays#4116 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug server-sequentialthinking v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
modelcontextprotocol/servers#5526 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug CLI exec
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày