diff options
| -rw-r--r-- | AGENTS.md | 16 | ||||
| -rw-r--r-- | README.md | 6 | ||||
| -rwxr-xr-x | bin/udt-palette | 9 | ||||
| -rwxr-xr-x | install.sh | 7 | ||||
| -rw-r--r-- | palette/roles.conf | 14 | ||||
| -rw-r--r-- | palette/roles.conf.default | 21 |
6 files changed, 50 insertions, 23 deletions
@@ -16,13 +16,19 @@ the record of what changed and where the backups are. ## One palette, many consumers Colours are written down once. `palette/<scheme>.conf` holds them under the -scheme's own names, `palette/roles-<scheme>.conf` says what each is for, and -`palette/roles.conf` is a single `scheme = ` line selecting the pair. -`bin/udt-palette` renders that into every consumer's own syntax; `install.sh` -runs it first, before anything is linked. +scheme's own names and `palette/roles-<scheme>.conf` says what each is for. +`bin/udt-palette` renders that pair into every consumer's own syntax; +`install.sh` runs it first, before anything is linked. + +**The scheme selection lives outside the repo**, in `~/.config/udt/roles.conf`, +seeded from `palette/roles.conf.default` on a first install and never +overwritten after. That is deliberate: which theme a machine runs is local +state, so switching does not dirty the working tree and two machines sharing +this repo can differ. It is the one exception to this repo holding the +canonical copy of everything. Four schemes ship: `macchiato`, `tokyo-night`, `nord`, `dracula`. Switching is -one line plus `./install.sh`. +one line in `~/.config/udt/roles.conf` plus `./install.sh`. Generated files are gitignored, because tracking them would turn every scheme switch into a diff. Editing one is pointless: the next install overwrites it. @@ -35,11 +35,13 @@ GPLv2 only. See `LICENSE`. ## Changing the colour scheme -Edit one line in `palette/roles.conf`: +Edit one line in `~/.config/udt/roles.conf`: scheme = macchiato -and run `./install.sh`. Ships with `macchiato`, `tokyo-night`, `nord` and +and run `./install.sh`. That file is yours, not the repo's: `install.sh` +creates it on a first run and never overwrites it, so switching scheme leaves +the working tree clean. Ships with `macchiato`, `tokyo-night`, `nord` and `dracula`; rofi, dunst, conky, waybar, kitty, Firefox and quickshell all follow. diff --git a/bin/udt-palette b/bin/udt-palette index b2951c6..60a21fa 100755 --- a/bin/udt-palette +++ b/bin/udt-palette @@ -20,6 +20,13 @@ from pathlib import Path REPO = Path(__file__).resolve().parent.parent PALETTE_DIR = REPO / "palette" +# The scheme selection is the user's, not the repo's, so it lives outside the +# working tree: switching scheme should not show up as a diff, and two machines +# sharing this repo can run different schemes. install.sh seeds it from +# palette/roles.conf.default on a first run and never overwrites it after. +SELECTOR = Path.home() / ".config" / "udt" / "roles.conf" +SELECTOR_SEED = PALETTE_DIR / "roles.conf.default" + def parse_conf(path): """Parse `key = value` lines into a dict, preserving order. @@ -393,7 +400,7 @@ def main(argv): selftest() return 0 - roles_path = PALETTE_DIR / "roles.conf" + roles_path = SELECTOR if SELECTOR.exists() else SELECTOR_SEED out_dir = REPO if "--roles" in argv: roles_path = Path(argv[argv.index("--roles") + 1]).expanduser() @@ -13,6 +13,11 @@ mkdir -p "$target" "$HOME/bin" "$HOME/.cache/wal" # symlinked below is one of its outputs, so this has to run before anything is # linked. It fails loudly if a role names a colour the scheme does not define, # which is the whole point of keeping the colours in one place. +selector="$HOME/.config/udt/roles.conf" +if [ ! -f "$selector" ]; then + install -Dm644 "$repo/palette/roles.conf.default" "$selector" + echo "seeded $selector" +fi "$repo/bin/udt-palette" # Theme files are symlinked individually; accent.rasi is NOT, it points at the @@ -41,7 +46,7 @@ ln -sfn "$repo/bin/udt-palette" "$HOME/bin/udt-palette" # The generated configs for everything that is not rofi. These are copied # rather than symlinked: each app owns its config file and mixes theme keys # with settings that are none of this repo's business. -scheme="$(sed -n 's/^scheme *= *//p' "$repo/palette/roles.conf")" +scheme="$(sed -n 's/^scheme *= *//p' "$selector")" # waybar reads whichever themes/<name>.css style.css imports, so write the file # under the scheme's own name and repoint the import. The older per-flavour diff --git a/palette/roles.conf b/palette/roles.conf deleted file mode 100644 index a1ca448..0000000 --- a/palette/roles.conf +++ /dev/null @@ -1,14 +0,0 @@ -# Scheme selection. -# Copyright (C) 2026 Danilo M. <danix@danix.xyz> -# Licensed under the GNU General Public License v2 only. -# -# This is the one line to change to retheme the desktop. It picks a pair of -# files: palette/<scheme>.conf, which holds the colours under the scheme's own -# names, and palette/roles-<scheme>.conf, which says what each colour is for. -# -# Run ./install.sh afterwards. Every themed config is generated from that pair, -# so nothing else needs editing. -# -# Available: macchiato, tokyo-night, nord, dracula - -scheme = tokyo-night diff --git a/palette/roles.conf.default b/palette/roles.conf.default new file mode 100644 index 0000000..556ef56 --- /dev/null +++ b/palette/roles.conf.default @@ -0,0 +1,21 @@ +# Scheme selection. +# Copyright (C) 2026 Danilo M. <danix@danix.xyz> +# Licensed under the GNU General Public License v2 only. +# +# This file is the SEED. install.sh copies it to ~/.config/udt/roles.conf on a +# first run and never touches it again, so edit the copy, not this one. +# +# The live file picks a pair: palette/<scheme>.conf, which holds the colours +# under the scheme's own names, and palette/roles-<scheme>.conf, which says +# what each colour is for. +# +# $EDITOR ~/.config/udt/roles.conf # change the scheme line +# ./install.sh # regenerate every config +# +# Keeping the selection outside the repo means switching scheme does not dirty +# the working tree, and two machines sharing this repo can run different +# schemes. +# +# Available: macchiato, tokyo-night, nord, dracula + +scheme = macchiato |
