fix(theming): sync gtk-theme with color-scheme when system sync is on

This commit is contained in:
Lysec
2026-03-31 03:09:55 +02:00
parent 40c8b17620
commit 09386b1903
2 changed files with 10 additions and 9 deletions
+6 -5
View File
@@ -99,8 +99,9 @@ async def apply_gtk4_colors(config_dir: Path):
async def sync_system_appearance(mode: str, *, update_gtk_theme: bool = True) -> None:
"""
Push light/dark to org.gnome.desktop.interface (gsettings or dconf fallback).
Used by the GTK template post-hook (also sets gtk-theme when update_gtk_theme)
and by Noctalia on dark-mode toggle (--appearance-only: color-scheme only).
Used by the GTK template post-hook and ColorSchemeService when "Sync system theme"
is on (both set color-scheme and gtk-theme when themes exist). --appearance-only
skips CSS and only updates color-scheme for narrow tooling use.
"""
has_gsettings = shutil.which("gsettings")
has_dconf = shutil.which("dconf")
@@ -177,9 +178,9 @@ async def main():
await sync_system_appearance(mode, update_gtk_theme=True)
print("GTK colors applied successfully")
else:
# Still push light/dark preference so portal/GTK apps follow the shell even when
# gtk.css / noctalia.css setup failed.
await sync_system_appearance(mode, update_gtk_theme=False)
# CSS setup failed; still align gsettings (color-scheme + gtk-theme when themes exist)
# so apps do not end up with mismatched prefer-dark vs adw-gtk3 (inverted look).
await sync_system_appearance(mode, update_gtk_theme=True)
sys.exit(1)