6.9 KiB
6.9 KiB
Tasks: theme-switch
1. Per-theme metadata
- 1.1 Create
~/.config/colorschemes/<theme>/metafor each of the 11 existing themes withname=<Display Name>andmode=dark(ormode=lightfore-inkandnoir).
2. Theme module scaffold
- 2.1 Create
modules/home-manager/theme/default.nixdeclaringoptions.custom.theme.current(string, default"gruvbox-dark") andoptions.custom.theme.enable(bool). - 2.2 Embed the
theme-switchshell script in the module viapkgs.writeShellScriptBinso it's installed to~/.local/bin/theme-switch. - 2.3 Embed the
theme-pickershell script in the module viapkgs.writeShellScriptBinso it's installed to~/.local/bin/theme-picker. - 2.4 Add a systemd user oneshot
theme-apply.servicethat runstheme-switch(no args) ongraphical-session.target. - 2.5 Add a
home.activationblock that creates~/.config/colorschemes/.active(symlink tocustom.theme.current) and.current(text file with the name) if missing.
3. theme-switch script
- 3.1 Implement argument parsing:
<theme-name>switches; no args reads.currentand re-applies. - 3.2 Validate
<theme-name>exists under~/.config/colorschemes/; print list and exit non-zero otherwise. - 3.3 Refuse to proceed if
~/.config/colorschemes/.activeis a non-symlink directory (defensive guard). - 3.4 Atomically swap
.activewithln -sfn. - 3.5 Write
<theme-name>to~/.config/colorschemes/.current. - 3.6 Parse the new theme's
metaforname=andmode=. - 3.7 Emit
gsettings set org.gnome.desktop.interface color-scheme prefer-{dark,light}based onmode=. - 3.8 Update hyprland config: rewrite
~/.config/hypr/hyprland.confso itssource =directive points at~/.config/colorschemes/.active/hypr/colors.conf. No signal (hyprland watches). - 3.9 Update waybar: atomic symlink swap for
~/.config/waybar/themes/current.css→<theme>/waybar/colors.css, thenpkill -USR2 waybar. - 3.10 Update swaync: atomic swap for
~/.config/swaync/colors.css→<theme>/swaync/colors.css, thenswaync-client --reload-css. - 3.11 Update wlogout: atomic swap for
~/.config/wlogout/style.css→<theme>/wlogout/style.css. No live signal (next-launch reload). - 3.12 Update kitty:
kitty @ set-colors --all ~/.config/colorschemes/.active/kitty/colors.conf. - 3.13 Update ghostty:
pkill -SIGUSR1 ghostty. - 3.14 Update alacritty: atomic swap for
~/.config/alacritty/colors.toml→<theme>/alacritty/colors.toml. No live signal (next-launch reload). - 3.15 Update nvim: if
$NVIMis set,nvim --remote-expr 'lua vim.cmd.colorscheme("<name>")'. Else no-op. - 3.16 If
~/.config/colorschemes/.hookexists and is executable, run~/.config/colorschemes/.hook <theme-name>at the end. Tolerate non-zero exit. - 3.17 Notify via
notify-send "Theme: <name>"if libnotify is available.
4. theme-picker script
- 4.1 List
~/.config/colorschemes/*/metafiles. - 4.2 Parse each
metaforname=andmode=. - 4.3 Pipe the formatted entries (
<name> (<mode>)) intorofi -dmenu -p "Theme". - 4.4 On selection, invoke
theme-switch <selected-theme-name>and exit with its status.
5. Cleanup pass: swaync
- 5.1 Strip the inline gruvbox color strings from
modules/home-manager/swaync/default.nix(theletblock at the top withbackground,text, etc.). - 5.2 Replace the
style = ''...''block withxdg.configFile."swaync/style.css".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/swaync/style.css"(so the file lives in dotfiles and is theme-driven). - 5.3 Verify
~/.config/colorschemes/<theme>/swaync/colors.cssexists for all 11 themes; if any are missing, copy fromgruvbox-dark/swaync/colors.cssas a placeholder.
6. Cleanup pass: wlogout
- 6.1 Strip the inline gruvbox color strings from
modules/home-manager/wlogout/default.nix. - 6.2 Replace the
style = ''...''block withxdg.configFile."wlogout/style.css".source = config.lib.file.mkOutOfStoreSymlink .... - 6.3 Verify
~/.config/colorschemes/<theme>/wlogout/colors.cssexists for all 11 themes.
7. Cleanup pass: alacritty
- 7.1 Keep font, opacity, padding, blur in
modules/home-manager/alacritty/default.nix. - 7.2 Add
import = [ "~/.config/alacritty/colors.toml" ]toprograms.alacritty.settings. - 7.3 Ensure
~/.config/colorschemes/<theme>/alacritty/colors.tomlexists for all 11 themes (or document a one-time port if the existing files are in a different format). - 7.4 Add
xdg.configFile."alacritty/colors.toml".source = out-of-store symlink to ~/.config/colorschemes/.active/alacritty/colors.toml(or document leaving it as a mutable file the script swaps).
8. Cleanup pass: darkman
- 8.1 Remove the
gtk-themekey from bothservices.darkman.darkModeScriptsandservices.darkman.lightModeScripts. - 8.2 Leave the
hyprsunsetkey in both modes (still time-of-day driven). - 8.3 Add a comment in the module noting that gsettings
color-schemeis now owned bytheme-switch.
9. Hyprland integration
- 9.1 In
modules/home-manager/hyprland/default.nix(or the lua config it writes), ensure~/.config/hypr/hyprland.confsources~/.config/colorschemes/.active/hypr/colors.conf. - 9.2 Strip inline color hex strings (active/inactive border) from the lua config.
- 9.3 Add the
SUPER+Tkeybind to launchtheme-picker(in thehl.bindblock).
10. Wire into hosts
- 10.1 Add
../../modules/home-manager/themetoimportsinhosts/jpporta-nixos/home.nix. - 10.2 Set
custom.theme.current = "gruvbox-dark";(or another default) in the same file. - 10.3 (Bonus, deck) Add
../../modules/home-manager/themetoimportsinhosts/writter-deck/home.nixand setcustom.theme.current. - 10.4 (Bonus, deck) Add a footserver-specific step to
theme-switchthat sends SIGUSR1 to the running footserver, or skips if none.
11. Verification
- 11.1
home-manager switchsucceeds with no errors after all module changes. - 11.2
~/.config/colorschemes/.activeexists and resolves to the configured theme on first boot. - 11.3
theme-switch catppuccin(or any other valid theme) swaps.active, updates.current, and emits each per-app reload signal. - 11.4 Each themed app reflects the new palette within ~2 seconds (manual eyeball test).
- 11.5
theme-switch does-not-existprints the list of valid themes and exits non-zero without modifying.active. - 11.6
theme-pickeropens rofi, lists all 11 themes with their mode suffix, and switches on selection. - 11.7
SUPER+Tin Hyprland opens the rofi picker. - 11.8 After a logout/login, the desktop matches
.current(the systemd oneshot ran). - 11.9 Drop a placeholder
~/.config/colorschemes/.hookthat logs the theme name; verify it runs after a switch. - 11.10 (Deck, if wired)
theme-switchworks on the deck and footserver reloads colors (or relaunches).