theming: ghostty and btop read through the state symlink
Drops the copy step for both: a switch is now just the ln -sfn, so there is no second write to fail and no stale copy to survive. Verified with ghostty +show-config that retargeting the link alone changes the effective background/foreground. Also log the applied theme per run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
43f6a886ac
commit
8e33a7ba12
1 changed files with 19 additions and 4 deletions
|
|
@ -385,12 +385,18 @@ let
|
|||
theme="$1"
|
||||
[ -d "$theme" ] || exit 0
|
||||
|
||||
# One line per run, so the journal answers "did it fire, and with what?"
|
||||
# without any guessing: journalctl --user -u quickshell | grep theme-apply
|
||||
echo "theme-apply: $theme" >&2
|
||||
|
||||
ln -sfn "$theme" ${lib.escapeShellArg stateLink}
|
||||
|
||||
# Only the files an app insists on finding at a fixed path get copied.
|
||||
# Ghostty and btop are pointed straight at the state symlink instead
|
||||
# (see the home-manager block below) — one less write to go wrong, and no
|
||||
# way for a stale copy to survive a switch.
|
||||
install -Dm644 "$theme/gtk3.css" "$HOME/.config/gtk-3.0/gtk.css"
|
||||
install -Dm644 "$theme/gtk4.css" "$HOME/.config/gtk-4.0/gtk.css"
|
||||
install -Dm644 "$theme/ghostty.conf" "$HOME/.config/ghostty/theme.conf"
|
||||
install -Dm644 "$theme/btop.theme" "$HOME/.config/btop/themes/runtime.theme"
|
||||
install -Dm644 "$theme/vesktop.css" "$HOME/.config/vesktop/settings/quickCss.css"
|
||||
install -Dm644 "$theme/zen.css" "$HOME/${zenChrome}/userChrome.css"
|
||||
|
||||
|
|
@ -500,9 +506,18 @@ in
|
|||
name = "Papirus-Fred";
|
||||
};
|
||||
|
||||
programs.ghostty.settings.config-file = "?${homeDir}/.config/ghostty/theme.conf";
|
||||
# Both read straight through the state symlink, so a switch is nothing
|
||||
# but the `ln -sfn` in theme-apply — no copy to fail, nothing stale.
|
||||
#
|
||||
# The leading `?` marks the include optional: before the first
|
||||
# theme-apply of a fresh account the link does not exist yet, and
|
||||
# without it ghostty treats that as a config error. Includes are also
|
||||
# applied AFTER the file that names them, so these colours win over
|
||||
# anything home-manager writes above.
|
||||
programs.ghostty.settings.config-file = "?${stateLink}/ghostty.conf";
|
||||
# Manual escape hatch; the switcher itself reloads over D-Bus.
|
||||
programs.ghostty.settings.keybind = [ "ctrl+shift+alt+f12=reload_config" ];
|
||||
programs.btop.settings.color_theme = "${homeDir}/.config/btop/themes/runtime.theme";
|
||||
programs.btop.settings.color_theme = "${stateLink}/btop.theme";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue