diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-16 08:37:28 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-16 08:37:28 +0200 |
| commit | b970a0deaad3a6723fe5727a3db7b653ebb3e7a3 (patch) | |
| tree | 2b85acb01b9c265f657546690addeeb389a229fd | |
| parent | 593b8a65eda7ba9f7c7341ef5c1584b92bfda9c4 (diff) | |
| download | unified-desktop-theme-b970a0deaad3a6723fe5727a3db7b653ebb3e7a3.tar.gz unified-desktop-theme-b970a0deaad3a6723fe5727a3db7b653ebb3e7a3.zip | |
refactor(cache): move the generated files to ~/.cache/udt
They lived in ~/.cache/wal because pywal owned that directory and udt-accent
was written alongside a pywal run. Nothing on this desktop invokes pywal any
more: the wal binary is unused, and udt-accent imports pywal.backends.colorz
as a quantisation library, which writes nothing. Sharing the cache only left
the ownership ambiguous.
colors.json is the one file that cannot move. pywalfox hardcodes
<cache>/wal/colors.json and honours only XDG_CACHE_HOME, which would relocate
every cache on the system, so udt-accent writes the real file to ~/.cache/udt
and install.sh symlinks the old path at it. ~/.cache/wal now holds that link
and nothing else.
Consumers repointed here: install.sh, udt-accent, launcher.rasi's @WPAPER@.
Outside the repo, wallp, Hyprland's look_and_feel.lua and quickshell's
shared/Theme.qml move with it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| -rw-r--r-- | AGENTS.md | 22 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | bin/udt-accent | 16 | ||||
| -rw-r--r-- | docs/MIGRATION.md | 2 | ||||
| -rwxr-xr-x | install.sh | 22 | ||||
| -rw-r--r-- | rofi/udt/launcher.rasi | 2 |
6 files changed, 45 insertions, 21 deletions
@@ -113,9 +113,9 @@ One colour moves: `@accent`. `bin/udt-accent` reads the current wallpaper, extracts its signature colour, and snaps it to the nearest of ten Catppuccin accents by perceptual hue in CIELAB. `wallp` calls it on every wallpaper change. -It writes five things: `~/.cache/wal/udt-accent.rasi` (rofi), -`~/.cache/wal/udt-border.lua` (Hyprland), `~/.cache/wal/colors.json` -(Firefox, via pywalfox), `~/.cache/wal/udt-palette.qml` (quickshell), and +It writes five things: `~/.cache/udt/udt-accent.rasi` (rofi), +`~/.cache/udt/udt-border.lua` (Hyprland), `~/.cache/wal/colors.json` +(Firefox, via pywalfox), `~/.cache/udt/udt-palette.qml` (quickshell), and the accent substitution in Sublime's installed `Packages/User/udt.sublime-color-scheme`. @@ -133,14 +133,24 @@ Macchiato values are written down. Quickshell components watch the generated file and re-read it in place, so a palette edit reaches a running shell without restarting it; see the `quickshell` repo alongside this one. -**Extraction is deliberately isolated from the pywal cache.** It calls +**The generated files live in `~/.cache/udt/`**, not `~/.cache/wal/`. pywal no +longer writes anything on this desktop, so sharing its cache directory only +made the ownership ambiguous. + +`colors.json` is the one exception, and it is why `~/.cache/wal/` still exists. +pywalfox hardcodes `<cache>/wal/colors.json` and honours only `XDG_CACHE_HOME`, +which would move every cache on the system, so `udt-accent` writes the real +file to `~/.cache/udt/` and `install.sh` symlinks the old path at it. That +directory now holds the link and nothing else. + +**Extraction is deliberately isolated from pywal's cache.** It calls `pywal.backends.colorz.get()` directly, which returns a list and writes nothing. Running `wal -i` instead would rewrite all of `~/.cache/wal`, including the terminal's ANSI colours, and that is the exact failure this design exists to avoid. If you change `signature_color()`, verify it still writes nothing. -`colors.json` is the one pywal file `udt-accent` does rewrite, and it rewrites -it wholesale rather than editing it: a fixed Macchiato palette with the accent +`colors.json` is rewritten wholesale rather than edited: a fixed Macchiato +palette with the accent in the cursor and the two highlight slots. That is deliberate. pywalfox reads `colors.json` and nothing else, so it is the only way Firefox can follow the accent, and overwriting it costs nothing because nothing else reads it. In @@ -10,7 +10,7 @@ Phase 1 covers rofi. Later phases extend the same palette to waybar, conky, hyprland and quickshell. Quickshell reads the palette rather than restating it: `udt-accent` writes -`~/.cache/wal/udt-palette.qml` from `rofi/udt/palette.rasi`, and the +`~/.cache/udt/udt-palette.qml` from `rofi/udt/palette.rasi`, and the components in the `quickshell` repo watch that file, so editing the palette here recolours them without a restart. diff --git a/bin/udt-accent b/bin/udt-accent index 3cb9438..391664b 100755 --- a/bin/udt-accent +++ b/bin/udt-accent @@ -9,6 +9,7 @@ Usage: udt-accent <wallpaper-path> The extraction deliberately calls pywal's colorz backend directly rather than running `wal -i`, because `wal -i` rewrites the whole ~/.cache/wal directory +(which this no longer writes to, but pywal still would) including the terminal's ANSI colors. See the design spec for why that matters. """ @@ -29,17 +30,22 @@ from udt_colors import ACCENTS, FALLBACK, PALETTE, SCHEME # noqa: E402 MIN_CHROMA = 10.0 -OUTPUT = Path.home() / ".cache" / "wal" / "udt-accent.rasi" -BORDER_OUTPUT = Path.home() / ".cache" / "wal" / "udt-border.lua" +CACHE = Path.home() / ".cache" / "udt" +OUTPUT = CACHE / "udt-accent.rasi" +BORDER_OUTPUT = CACHE / "udt-border.lua" SUBLIME = (Path.home() / ".config" / "sublime-text" / "Packages" / "User" / "udt.sublime-color-scheme") -QML_OUTPUT = Path.home() / ".cache" / "wal" / "udt-palette.qml" +QML_OUTPUT = CACHE / "udt-palette.qml" # The installed rofi palette, itself generated by udt-palette. Read rather than # duplicated so the QML singleton carries exactly the colours rofi uses, under # the same names. PALETTE_RASI = Path.home() / ".config" / "rofi" / "udt" / "palette.rasi" -COLORS_JSON = Path.home() / ".cache" / "wal" / "colors.json" +# pywalfox hardcodes <cache>/wal/colors.json and honours only XDG_CACHE_HOME, +# which would move every cache, so this one file is written where it looks. +# install.sh symlinks ~/.cache/wal/colors.json here, so the real file lives +# with the rest of the palette and ~/.cache/wal holds nothing but that link. +COLORS_JSON = CACHE / "colors.json" def write_atomic(path, content): @@ -238,7 +244,7 @@ def write_colors_json(name, image): doc = { # Resolved, not as passed: wallp gives the real file but a caller may - # give ~/.cache/wal/wpaper, the symlink to it. Same wallpaper either + # give ~/.cache/udt/wpaper, the symlink to it. Same wallpaper either # way, so record one spelling. "wallpaper": os.path.realpath(image), "alpha": "100", diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md index e78b766..3ccb49a 100644 --- a/docs/MIGRATION.md +++ b/docs/MIGRATION.md @@ -25,7 +25,7 @@ immediately before the edits, are in `/data/udt-backup/`. ### Other edits - `~/bin/wallp`: `finalize()` now calls `udt-accent` with - `~/.cache/wal/wpaper`, guarded so a failure cannot stop the wallpaper being + `~/.cache/udt/wpaper`, guarded so a failure cannot stop the wallpaper being set. - `~/bin/rofipass`: dropped a `-width 1000` flag. It is not a rofi 2.0.0 @@ -7,7 +7,7 @@ set -euo pipefail repo="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" target="$HOME/.config/rofi/udt" -mkdir -p "$target" "$HOME/bin" "$HOME/.cache/wal" +mkdir -p "$target" "$HOME/bin" "$HOME/.cache/udt" # Generate every themed config from the selected scheme first: the rofi palette # symlinked below is one of its outputs, so this has to run before anything is @@ -30,15 +30,23 @@ done # from the wal cache and cannot be committed. Regenerating it is why re-running # this script after moving the repo is safe. rm -f "$target/launcher.rasi" -sed "s|@WPAPER@|$HOME/.cache/wal/wpaper|" \ +sed "s|@WPAPER@|$HOME/.cache/udt/wpaper|" \ "$repo/rofi/udt/launcher.rasi" > "$target/launcher.rasi" # Seed the generated accent if it does not exist yet, so themes parse on a # fresh install before any wallpaper has been set. -if [ ! -f "$HOME/.cache/wal/udt-accent.rasi" ]; then - cp "$repo/rofi/udt/accent.rasi" "$HOME/.cache/wal/udt-accent.rasi" +if [ ! -f "$HOME/.cache/udt/udt-accent.rasi" ]; then + cp "$repo/rofi/udt/accent.rasi" "$HOME/.cache/udt/udt-accent.rasi" fi -ln -sfn "$HOME/.cache/wal/udt-accent.rasi" "$target/accent.rasi" +ln -sfn "$HOME/.cache/udt/udt-accent.rasi" "$target/accent.rasi" + +# Firefox's bridge is the one consumer that cannot follow: pywalfox hardcodes +# <cache>/wal/colors.json and honours only XDG_CACHE_HOME, which would move +# every cache on the system. So udt-accent writes the real file with the rest +# of the palette and this points pywalfox at it, leaving ~/.cache/wal holding +# nothing but the link. +mkdir -p "$HOME/.cache/wal" +ln -sfn "$HOME/.cache/udt/colors.json" "$HOME/.cache/wal/colors.json" ln -sfn "$repo/bin/udt-accent" "$HOME/bin/udt-accent" ln -sfn "$repo/bin/udt-palette" "$HOME/bin/udt-palette" @@ -153,8 +161,8 @@ command -v hyprctl >/dev/null 2>&1 && hyprctl reload >/dev/null 2>&1 && reloaded # udt-accent regenerates the accent. It needs a wallpaper to read; without one # the accent keeps its current value. Quickshell watches the palette it writes, # so notifications and the rest of the shell follow without a restart. -if command -v udt-accent >/dev/null 2>&1 && [ -e "$HOME/.cache/wal/wpaper" ]; then - udt-accent "$HOME/.cache/wal/wpaper" >/dev/null 2>&1 && reloaded="$reloaded accent" +if command -v udt-accent >/dev/null 2>&1 && [ -e "$HOME/.cache/udt/wpaper" ]; then + udt-accent "$HOME/.cache/udt/wpaper" >/dev/null 2>&1 && reloaded="$reloaded accent" fi # conky has no hot-reload and nothing respawns it, so it is restarted only if diff --git a/rofi/udt/launcher.rasi b/rofi/udt/launcher.rasi index 282889c..0317be5 100644 --- a/rofi/udt/launcher.rasi +++ b/rofi/udt/launcher.rasi @@ -24,7 +24,7 @@ mainbox { * * The path is a placeholder: rofi does not expand `~` inside a url(), and a * real absolute path would bake a home directory into a committed file. The - * installer rewrites this line with the concrete path to ~/.cache/wal/wpaper, + * installer rewrites this line with the concrete path to ~/.cache/udt/wpaper, * which is a symlink that wallp keeps pointed at the current horizontal * wallpaper. */ inputbar { |
