Files

2.4 KiB

omarchy-gtk-theme-sync

Make Nautilus and other GTK apps follow your Omarchy theme's colors, not just light/dark.

Omarchy only switches GTK between Adwaita and Adwaita-dark and sets a Yaru icon color. This adds a GTK color template, a theme-set hook, and a small Nautilus extension that recolors open windows live. Everything lives in your home directory, so omarchy update does not overwrite it.

Tested on Omarchy 4.0.4 (Hyprland, Nautilus 50, libadwaita).

Install

git clone https://git.zacharyzhang.com/ZacharyZhang-NY/omarchy-gtk-theme-sync
cd omarchy-gtk-theme-sync
./omarchy-gtk-theme-sync install --icons
nautilus --quit   # once, so Nautilus loads the extension

--icons also removes any theme-set.d hook that pins a fixed GTK icon theme (for example a hook that forces Papirus). Such a hook is why folder colors change with the theme and then snap back to blue about a second later. Removed hooks are backed up next to the original.

Leave --icons off to keep your icon theme as it is.

Other commands

./omarchy-gtk-theme-sync status      # is it installed, which colors are live
./omarchy-gtk-theme-sync uninstall   # remove the template, hook and generated gtk.css

If you already have your own ~/.config/gtk-{3,4}.0/gtk.css, install refuses to touch it. --force backs it up and replaces it.

What it writes

File Purpose
~/.config/omarchy/themed/gtk.css.tpl libadwaita named colors from the theme's colors.toml
~/.config/omarchy/hooks/theme-set.d/20-gtk-colors copies the rendered gtk.css to gtk-3.0 and gtk-4.0
~/.config/gtk-3.0/gtk.css, ~/.config/gtk-4.0/gtk.css generated on every theme change
~/.local/share/nautilus-python/extensions/omarchy_theme_live.py reloads the theme's gtk.css inside Nautilus the moment the theme changes

How the live recolor works

GTK reads gtk.css once, when an app starts, and Nautilus also stays alive for 60 seconds after its last window closes, so without help a theme change only shows up in a freshly started Nautilus. The extension (run by nautilus-python, which Omarchy installs) loads the theme's gtk.css as an extra style provider inside the Nautilus process and reloads it as soon as Omarchy swaps in the new theme directory, before the slower theme-set hooks run, so open windows recolor within about 0.3 seconds of a theme switch.

Other GTK apps still pick the colors up the next time they start.