mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(theming): sync gtk-theme with color-scheme when system sync is on
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user