Theme Change has inverse effect on some GTK apps.
Compositor
- [x] niri
- [ ] Hyprland
- [ ] Other (specify)
Description
Theme change from light/dark causes incorrect switching. Quickly clicking the theme switcher twice ( light->dark->light) shows correct color.
Reopening the app also works. But for nautilus have to do pkill as it is still run in background.
This has affected nautilus and gtk-demo but not firefox?
First screen-recording shows with Adwaita theme ( affects nautilus but not gtk-demo(not seen in recording) and firefox) Second screen-recording shows with Colloid theme ( affect nautilus and gtk-demo but not firefox)
This is probably happening because gsettings is called before matugen has finished updating the css file?
Possible solution?: If matugen should be run i.e Matugen is not disabled, run it first before calling themeChange / setting gsettings color-scheme key.
Expected Behavior
Correct switching of theme in GTK apps.
Steps to Reproduce
Currently using Adwaita Theme, but happens in Colloid theme as well.
- import dank-colors.css to gtk.css in ~/.config/gtk-4.0/ ( or apply gtk theme from settings)
- Change theme color-scheme repeatedly
- Incorrect theme colors chosen
Screenshots/Recordings
https://github.com/user-attachments/assets/af563cce-83c4-4f77-8569-8df6236e967e
https://github.com/user-attachments/assets/f5859cb0-7b97-4623-bc28-840318b8487d
Theme change from light/dark causes incorrect switching. Quickly clicking the theme switcher twice ( light->dark->light) shows correct color.
This part is fixed
The other one, gsettings already runs after matugen. I think maybe something else is lacking to notify the apps to update for colors.
Thanks, Can you link the commit? I will check it later today.
9a43465ebf3909b09f784ab1f845952d0844c0d8
Still doesn't fix the stated issue. It still doesn't work for natuilus and gtk4-demo. Still same as in recording.
Oh that fixes the bug in cc icon? I didn't notice that. However main issue still remains. Maybe even though matugen is called before gsettings, matugen doesn't finish recalculating values and updating files? Some kind of race condition?
Cause dark/light mode switch does change the theme but does so out of sync/inversely(i.e when dark mode is on light theme colors is shown in natuilus)
I think this is probably resolved, via the adw-gtk3 path that is now documented instead of colloid
$ pacman -Qi dms-shell-git Name : dms-shell-git Version : 0.1.17.r5.gacc067f-1
Using adw-gtk3
It tries to change the color but is lagging behind a step in nautilus. Whereas some GTK apps tries to change and then falls back to light mode. A slightly more deeper debug is required why it is happening. If you have any idea how could I debug this, I will be free to do so. For example, looking at what changes when we toggle the theme mode and when the signal hits the gtk app and what do they see in the config.
Still only works reliably when I do the following:
- To change from Light -> Dark theme, first click once so that it is at dark mode.
- This dark mode is broken, i.e not all apps are in dark mode.
- Quickly double press the the theme switcher so that Dark->Light->Dark change happens.
- Now it works.
https://github.com/user-attachments/assets/1c83fe49-f286-49d1-b1a8-ff2d30bd94f6
@bbedward
I did some testing by putting a delay on gsettings and the theme change works.
This is probably happening because gsettings is called before matugen has finished updating the css file?
I had this hypothesis since the beginning, and now I am sure that the bug is (most probably) due to that.
Here's my modification and checking with delayed gsettings call.
If you have a cleaner solution, actually blocking the gsettings call before matugen process finishes then please look into it. Else a delayed call to gsettings works for now.
https://github.com/user-attachments/assets/8c98cbd6-5b0f-409e-8331-12fa9d0d42e0
Check this one 4aa0b3d0fcb55212965781a8e6fc851f202cea34
@bbedward , Great! Theme/Color-scheme change works properly now. I'll close this issue as the issue below is unrelated to theme change.
Some theme accents are missing
Probably introduced after f54e53b ? ( only guessing ).However some accent colors like text highlights input highlights are missing from firefox and other gtk apps.
In general, previously with colloid or before this commit (idk?) text highlights and other stuffs used to be more uniformly themed. Text colors and background, accent used to be more visible.
Now, only some places accent are visible.
Working accent:
Not-working accents: