Skip to content

fix: regenerate gtk.css/vicinae.toml on every theme switch - #56

Open
Krixam wants to merge 1 commit into
imbypass:mainfrom
Krixam:fix/gtk-vicinae-theme-not-updating
Open

fix: regenerate gtk.css/vicinae.toml on every theme switch#56
Krixam wants to merge 1 commit into
imbypass:mainfrom
Krixam:fix/gtk-vicinae-theme-not-updating

Conversation

@Krixam

@Krixam Krixam commented Aug 26, 2026

Copy link
Copy Markdown

Problem

omarchy-hook runs every script in a hook's .d/ directory twice:
once through the theme-set wrapper (which exports the color vars like
$primary_background, $normal_red, etc.), and once again directly by
its own loop, without those vars set (see /usr/share/omarchy/bin/omarchy-hook).

10-gtk.sh and 10-vicinae.sh guarded against that double-run by only
writing their output if [ ! -f "$output_file" ] (skip if it already
exists). That avoids the var-less second pass clobbering the good first
pass, but as a side effect it also permanently blocks regeneration on
every subsequent theme switch, since the output path
(~/.config/omarchy/current/theme/...) is fixed and reused across themes.

Worse: if either script's very first run ever happened before real color
vars were available (e.g. before colors.toml existed at its current
Omarchy 3.3+ path), it bakes in empty colors permanently — producing
invalid CSS like @define-color window_bg_color #;. GTK treats that as
"no background", so GTK4/libadwaita apps (Nautilus, GNOME Disks, etc.)
render fully transparent, showing the desktop through them — and no
later theme switch ever fixes it, because the file already exists.

Fix

Guard on [ -n "$primary_background" ] instead of file existence:
regenerate whenever real color data is actually present (every proper
pass, every theme switch), and no-op on the var-less second pass so it
leaves the good output from the first pass alone.

Testing

Reproduced on a live Omarchy install where gtk.css/vicinae.toml had
been stuck with empty colors since a very early hook run, surviving many
theme switches. Applied this fix, then switched themes back and forth
(e.g. Nord → Ristretto) and confirmed gtk.css and vicinae.toml
correctly picked up each theme's real colors every time, with no
regression from the double-invocation.

theme-set runs each theme-set.d/*.sh script twice: once through the
theme-set wrapper (which exports the color vars) and once again
directly by omarchy-hook's own loop, without those vars set.

10-gtk.sh and 10-vicinae.sh guarded against that double-run by only
generating output "if [ ! -f "$output_file" ]" (skip if it already
exists). That avoided the var-less second pass clobbering the first,
but as a side effect also permanently blocked regeneration on every
subsequent theme switch, since the output path is a fixed, reused
location. If either script's first-ever run happened before real
color vars were available (e.g. before colors.toml existed at its
current Omarchy 3.3+ path), it baked in empty colors and never
updated again for any theme afterwards - producing invalid CSS like
"@define-color window_bg_color #;", which makes GTK paint no
background at all, so GTK4/libadwaita apps (Nautilus, GNOME Disks,
etc.) render fully transparent.

Guard on `-n "$primary_background"` instead: regenerate whenever
real color data is present (every proper pass, every theme switch),
and no-op on the var-less second pass, leaving the good output from
the first pass untouched.

Verified by switching themes back and forth and confirming gtk.css
and vicinae.toml pick up the new theme's colors every time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant