aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-16 09:44:26 +0200
committerDanilo M. <danix@danix.xyz>2026-09-16 09:44:26 +0200
commit845e6d3f393811bdc78833c9457d9768e685e572 (patch)
treed8adbb5631936c55e95da08405a130b4525cf698
parentda1f0761e8a902b68134cdd9ec5eac3c549a9fcb (diff)
downloadwallp-master.tar.gz
wallp-master.zip
feat: drop pywal theming for the unified desktop themeHEADmaster
wallp no longer owns a colour theme. The --theme flag, the THEME config key, the persisted ~/.config/wallp/theme file and the wal invocation are gone; finalize now writes ~/.cache/udt/wpaper and hands it to udt-accent, which owns the whole palette (rofi, Hyprland, Firefox, quickshell, Sublime). That call is best-effort: a missing or failing udt-accent must never stop a wallpaper from being set, so wal is also dropped from the required-binary check. Tests follow the same shape: the theme-resolution and apply_theme cases are removed, the wal stub is replaced by udt-accent, and two new cases cover finalize calling udt-accent on the symlink and surviving its failure. Docs updated to match, including the install method: ~/bin/wallp is now a symlink to the checkout rather than a copy, so repo edits no longer need a manual re-copy to reach the live desktop. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
-rw-r--r--CLAUDE.md33
-rw-r--r--README.md67
-rw-r--r--tests/wallp.bats103
-rwxr-xr-xwallp64
-rw-r--r--wallp.conf.example2
5 files changed, 93 insertions, 176 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 3387dee..c30a2c8 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -7,14 +7,16 @@ Guidance for AI agents working in this repo.
`wallp` — a single bash script that sets and restores wallpapers on a fixed
two-screen wayland (sway/hyprland) setup. It merges two older scripts
(`multiwal.sh` interactive setter, `qar-lastwall.sh` restorer). Uses `swaybg` to
-paint wallpapers, `qarma` for GUI selection, `wal` (pywal) for the color theme.
+paint wallpapers, `qarma` for GUI selection, and `udt-accent` (the unified
+desktop theme tool, outside this repo) to refresh the accent colour from the
+wallpaper. `wallp` no longer runs pywal and has no theme of its own.
Logical screens are `H` (horizontal) and `V` (vertical), mapped to physical
outputs via config (`OUTPUT_H`/`OUTPUT_V`).
## Layout
-- `wallp` — the whole program (one bash file, ~320 lines).
+- `wallp` — the whole program (one bash file, ~310 lines).
- `tests/wallp.bats` — bats test suite (the only tests).
- `wallp.conf.example` — sample config.
- `docs/superpowers/specs/` — design spec.
@@ -29,7 +31,7 @@ bats tests/wallp.bats
```
Requires `bats` (1.5.0 known good). Tests run hermetically: `setup()` creates a
-temp `$HOME`, stubs `swaybg`/`wal`/`qarma`/`notify-send`/`pkill`/`kill` on `PATH`
+temp `$HOME`, stubs `swaybg`/`udt-accent`/`qarma`/`notify-send`/`pkill`/`kill` on `PATH`
(each logs its call to `$HOME/calls.log` and exits 0), then `source`s `wallp`.
The sourcing guard at EOF (`[ "${BASH_SOURCE[0]}" = "$0" ]`) keeps `main` from
running on source — **do not remove it.**
@@ -44,18 +46,18 @@ Syntax check: `bash -n wallp`.
the function directly when asserting on globals (`CONF_*`, `SET_*`) or
filesystem side effects, since `run` executes in a subshell.
- **Pure logic is unit-testable** (conf parse, arg parse, tilde expansion, output
- mapping, theme resolution). Side-effecting bits (`swaybg`, `wal`, `qarma`) are
- isolated in thin functions and exercised via the PATH stubs.
+ mapping). Side-effecting bits (`swaybg`, `udt-accent`, `qarma`) are isolated in
+ thin functions and exercised via the PATH stubs.
- `set -u` is on. Empty-array expansion `"${set_args[@]}"` is safe on bash ≥ 4.4
(this host is fine). Guard env vars with `${VAR:-}`.
- Quote all paths (wallpaper filenames may contain spaces).
## Critical gotchas
-- **Install is a COPY, not a symlink.** The live binary is `~/bin/wallp`, copied
- from this repo. After editing repo `wallp`, re-copy:
- `cp /home/danix/Programming/GIT/wallp/wallp ~/bin/wallp`
- Otherwise hypr autostart/keybind run the stale version.
+- **Install is a symlink.** `~/bin/wallp` points at this checkout's `wallp`, so
+ repo edits are live immediately for the hypr autostart/keybind. No re-copy
+ step. (It used to be a plain copy, which shipped stale versions.)
+ Recreate with: `ln -sf "$PWD/wallp" ~/bin/wallp`
- **qarma `--list` needs `--radiolist --print-column=2`.** A plain `--list`
prints nothing on selection (bug that shipped once). `qarma_select` depends on
these flags; a regression test guards it.
@@ -71,14 +73,17 @@ Syntax check: `bash -n wallp`.
the other — there's a test for this; keep it green.
- **`load_conf` return codes:** 0 ok, 1 invalid (missing required key), 10
bootstrapped (template just written → caller exits 0, no wallpaper change).
-- **Persistence is wallp-owned**, under `~/.config/wallp/` (`wall_h`, `wall_v`,
- `theme`). `~/.cache/wal/wpaper` symlink is still maintained (rofi reads it).
- `~/bin/wal.sh` was trimmed to dunst+kitty glue only; it no longer touches
- wallpaper pointers.
+- **Persistence is wallp-owned**, under `~/.config/wallp/` (`wall_h`, `wall_v`).
+ `finalize` writes the `~/.cache/udt/wpaper` symlink, then calls
+ `udt-accent "$HOME/.cache/udt/wpaper"`. That call is never fatal: if the binary
+ is missing or exits non-zero, the wallpaper still stands. `udt-accent` owns the
+ whole palette (rofi, Hyprland, Firefox, quickshell, Sublime), so nothing here
+ renders colours first.
## External integration (outside this repo)
-- `~/bin/wal.sh` — wal's `-o` hook; dunst + kitty theming only now.
+- `~/bin/udt-accent` — unified desktop theme accent picker; reads
+ `~/.cache/udt/wpaper`, writes the rest of the palette.
- `~/.config/hypr/sections/autostart.lua` → `wallp --restore`.
- `~/.config/hypr/sections/keybindings.lua` → `wallp --set` (mainMod+Return).
- Old `~/bin/multiwal.sh` + `qar-lastwall.sh` kept as fallback, unreferenced.
diff --git a/README.md b/README.md
index d66216f..394ba29 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
# wallp
A single-script wallpaper manager for a two-screen Wayland (sway / Hyprland)
-setup. Sets and restores wallpapers per screen, drives a [pywal](https://github.com/dylanaraps/pywal)
-color theme, and remembers what you had across reboots.
+setup. Sets and restores wallpapers per screen, refreshes the desktop accent
+colour to match, and remembers what you had across reboots.
It replaces two older scripts — an interactive setter and a session restorer —
with one flag-driven program.
@@ -16,10 +16,11 @@ with one flag-driven program.
restarted (no full-screen blank flash).
- **GUI or CLI** — pick wallpapers through a [qarma](https://github.com/luebking/qarma)
dialog, or pass file paths as arguments for scripted/headless use.
-- **Session restore** — re-applies the last wallpapers (and last theme) at login,
- falling back to configured defaults on first run.
-- **Theme persistence** — the last theme sticks until you change it; `--restore`
- brings it back, not the config default.
+- **Session restore** — re-applies the last wallpapers at login, falling back to
+ configured defaults on first run.
+- **Unified desktop theme** — after every change `wallp` hands the new wallpaper
+ to `udt-accent`, which owns the whole palette (rofi, Hyprland, Firefox,
+ quickshell, Sublime). `wallp` itself no longer runs pywal or stores a theme.
- **Self-bootstrapping config** — first run writes a template config and tells
you to fill it in, without touching your wallpapers.
@@ -29,25 +30,26 @@ with one flag-driven program.
|---------------|---------------------|--------------------------------------|
| `bash` | yes (≥ 4.4) | the script itself |
| `swaybg` | yes | paints the wallpaper on each output |
-| `wal` (pywal) | yes | generates/applies the color theme |
+| `udt-accent` | optional | refreshes the desktop accent colour |
| `qarma` | only for GUI `--set`| screen-choice menu + file picker |
-| `notify-send` | optional | desktop notification on theme change |
| `bats` | dev only | running the test suite |
`wallp` checks for the required binaries at startup and exits with a clear
-message if one is missing.
+message if one is missing. `udt-accent` is looked up at run time: if it is
+absent, or it fails, the wallpaper is still set and only the accent refresh is
+skipped.
## Install
`wallp` is a standalone script — put it somewhere on your `PATH`:
```bash
-cp wallp ~/bin/wallp
-chmod +x ~/bin/wallp
+ln -s "$PWD/wallp" ~/bin/wallp
```
-> **Note:** this is a plain copy. If you later edit the script in the repo,
-> re-copy it to `~/bin` for the change to take effect.
+A symlink keeps the installed command in step with the checkout, so edits take
+effect at once. A plain `cp wallp ~/bin/wallp && chmod +x ~/bin/wallp` works too,
+but then every repo edit needs a re-copy.
## Configuration
@@ -58,9 +60,6 @@ wallpaper** — edit it, then run again.
```ini
# ~/.config/wallp/wallp.conf
-# Optional. Defaults to sexy-splurge if omitted.
-THEME=sexy-splurge
-
# Physical output names. Find yours with:
# swaymsg -t get_outputs (sway)
# hyprctl monitors (Hyprland)
@@ -79,8 +78,8 @@ Format notes:
- Plain `key=value`, one per line. Blank lines and `#` comments are ignored.
- The file is **not** sourced as shell — it's parsed manually, so it can't run
code.
-- `OUTPUT_H`, `OUTPUT_V`, `DEFAULT_H`, `DEFAULT_V` are required. A missing or
- empty one is a hard error (named in the message). `THEME` is optional.
+- `OUTPUT_H`, `OUTPUT_V`, `DEFAULT_H`, `DEFAULT_V` are all required. A missing
+ or empty one is a hard error (named in the message).
## Usage
@@ -92,7 +91,6 @@ wallp --set H=<file> Set the horizontal screen only
wallp --set V=<file> Set the vertical screen only
wallp --set H=<f> V=<f> Set both screens
wallp --restore Restore last session (defaults if none saved)
-wallp --theme <name> Override the theme (combine with --set or --restore)
```
### Examples
@@ -109,22 +107,8 @@ wallp --set H=~/pics/wide.jpg V=~/pics/tall.jpg
# Restore on login (defaults on first ever run).
wallp --restore
-
-# Set a wallpaper and switch theme in one go; the theme persists afterwards.
-wallp --set H=~/pics/wide.jpg --theme gruvbox
```
-### Theme precedence
-
-When resolving which theme to apply, `wallp` uses, in order:
-
-1. `--theme <name>` on the command line,
-2. the last persisted theme (`~/.config/wallp/theme`),
-3. `THEME` from the config,
-4. the built-in default `sexy-splurge`.
-
-The resolved theme is always saved, so it carries across `--restore`.
-
### GUI vs CLI
`qarma` is used **only** to draw windows — the screen-choice menu, the file
@@ -145,21 +129,20 @@ State is owned entirely by `wallp`:
| `~/.config/wallp/wallp.conf` | configuration |
| `~/.config/wallp/wall_h` | persisted horizontal wallpaper path |
| `~/.config/wallp/wall_v` | persisted vertical wallpaper path |
-| `~/.config/wallp/theme` | persisted theme name |
| `~/.cache/wallp/H.pid` | PID of the horizontal `swaybg` |
-| `~/.cache/wallp/V.pid` | PID of the vertical `swaybg` |
-| `~/.cache/wal/wpaper` | symlink to the current horizontal image |
+| `~/.cache/wallp/V.pid` | PID of the vertical `swaybg` |
+| `~/.cache/udt/wpaper` | symlink to the current horizontal image |
Setting a screen: validate the file, kill **only** that screen's old `swaybg`,
launch a new one (`swaybg -o <output> -i <file> -m fill`), record the new PID,
-and save the path. Then update the `wpaper` symlink and apply the theme via
-`wal --backend colorz -nq --theme <name> -o ~/bin/wal.sh`.
+and save the path. Then update the `~/.cache/udt/wpaper` symlink and run
+`udt-accent ~/.cache/udt/wpaper` to re-derive the desktop accent colour.
Restoring: for each screen, use the saved path if present, otherwise the
-configured default; apply it; then re-apply the resolved (persisted) theme.
+configured default; apply it; then refresh the accent the same way.
-The `~/.cache/wal/wpaper` symlink is kept because other tools (e.g. rofi themes)
-read it.
+The `wpaper` symlink is the hand-off point to the rest of the theme: other
+tools (rofi, `udt-accent`) read it rather than `wallp`'s own state.
## Integration with sway / Hyprland
@@ -184,7 +167,7 @@ so they can be unit-tested. Tests use [bats](https://github.com/bats-core/bats-c
bats tests/wallp.bats
```
-The suite stubs `swaybg`, `wal`, `qarma`, and `notify-send` on `PATH` and runs
+The suite stubs `swaybg`, `udt-accent`, `qarma`, and `notify-send` on `PATH` and runs
against a temporary `$HOME`, so it touches nothing real. Contributions should
follow TDD — add a failing test first.
diff --git a/tests/wallp.bats b/tests/wallp.bats
index d16f1a3..56f3d54 100644
--- a/tests/wallp.bats
+++ b/tests/wallp.bats
@@ -8,7 +8,7 @@ setup() {
mkdir -p "$STUB_DIR"
export PATH="$STUB_DIR:$PATH"
local bin
- for bin in swaybg wal qarma notify-send pkill kill; do
+ for bin in swaybg udt-accent qarma notify-send pkill kill; do
cat > "$STUB_DIR/$bin" <<EOF
#!/bin/bash
echo "$bin \$*" >> "$TMP_HOME/calls.log"
@@ -42,13 +42,11 @@ teardown() {
conf="$HOME/c.conf"
printf '%s\n' \
'# comment' '' \
- 'THEME=mytheme' \
'OUTPUT_H=DP-1' \
'OUTPUT_V=DP-3' \
'DEFAULT_H=~/p/h.png' \
'DEFAULT_V=/abs/v.png' > "$conf"
parse_conf "$conf"
- [ "$CONF_THEME" = "mytheme" ]
[ "$CONF_OUTPUT_H" = "DP-1" ]
[ "$CONF_OUTPUT_V" = "DP-3" ]
[ "$CONF_DEFAULT_H" = "$HOME/p/h.png" ]
@@ -71,41 +69,6 @@ teardown() {
[[ "$output" == *"DEFAULT_V"* ]]
}
-@test "load_conf ok with THEME fallback" {
- mkdir -p "$HOME/.config/wallp"
- printf '%s\n' 'OUTPUT_H=DP-1' 'OUTPUT_V=DP-3' \
- 'DEFAULT_H=/a.png' 'DEFAULT_V=/b.png' \
- > "$HOME/.config/wallp/wallp.conf"
- load_conf
- [ "$?" -eq 0 ]
- [ "$CONF_THEME" = "sexy-splurge" ]
-}
-
-@test "resolve_theme flag wins over all" {
- CONF_THEME="conf"; mkdir -p "$HOME/.config/wallp"
- echo persisted > "$HOME/.config/wallp/theme"
- run resolve_theme flagged
- [ "$output" = "flagged" ]
-}
-
-@test "resolve_theme persisted beats conf" {
- CONF_THEME="conf"; mkdir -p "$HOME/.config/wallp"
- echo persisted > "$HOME/.config/wallp/theme"
- run resolve_theme ''
- [ "$output" = "persisted" ]
-}
-
-@test "resolve_theme uses conf when no persisted" {
- CONF_THEME="conf"
- run resolve_theme ''
- [ "$output" = "conf" ]
-}
-
-@test "persist_theme writes the file" {
- persist_theme "abc"
- [ "$(cat "$HOME/.config/wallp/theme")" = "abc" ]
-}
-
@test "output_for maps logical to physical" {
CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"
run output_for H
@@ -180,66 +143,71 @@ teardown() {
[ "$(cat "$HOME/.cache/wallp/H.pid")" = "99999" ]
}
-@test "update_wpaper symlinks to H image" {
+@test "finalize refreshes the accent from the wpaper symlink" {
: > "$HOME/h.png"; mkdir -p "$HOME/.config/wallp"
echo "$HOME/h.png" > "$HOME/.config/wallp/wall_h"
- update_wpaper
- [ "$(readlink "$HOME/.cache/wal/wpaper")" = "$HOME/h.png" ]
+ finalize
+ grep -q "udt-accent $HOME/.cache/udt/wpaper" "$HOME/calls.log"
+}
+
+@test "finalize survives a failing udt-accent" {
+ cat > "$STUB_DIR/udt-accent" <<'EOS'
+#!/bin/bash
+exit 1
+EOS
+ chmod +x "$STUB_DIR/udt-accent"
+ : > "$HOME/h.png"; mkdir -p "$HOME/.config/wallp"
+ echo "$HOME/h.png" > "$HOME/.config/wallp/wall_h"
+ run finalize
+ [ "$status" -eq 0 ]
}
-@test "apply_theme runs wal and persists theme" {
- apply_theme "mytheme"
- [ "$(cat "$HOME/.config/wallp/theme")" = "mytheme" ]
- grep -q "wal --backend colorz -nq --theme mytheme -o $HOME/bin/wal.sh" "$HOME/calls.log"
- grep -q "notify-send" "$HOME/calls.log"
+@test "update_wpaper symlinks to H image" {
+ : > "$HOME/h.png"; mkdir -p "$HOME/.config/wallp"
+ echo "$HOME/h.png" > "$HOME/.config/wallp/wall_h"
+ update_wpaper
+ [ "$(readlink "$HOME/.cache/udt/wpaper")" = "$HOME/h.png" ]
}
@test "restore uses persisted wallpapers" {
- CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"; CONF_THEME="conf"
+ CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"
CONF_DEFAULT_H="$HOME/dh.png"; CONF_DEFAULT_V="$HOME/dv.png"
: > "$HOME/saved_h.png"; : > "$HOME/saved_v.png"
mkdir -p "$HOME/.config/wallp"
echo "$HOME/saved_h.png" > "$HOME/.config/wallp/wall_h"
echo "$HOME/saved_v.png" > "$HOME/.config/wallp/wall_v"
- do_restore ""
+ do_restore
grep -q "swaybg -o DP-1 -i $HOME/saved_h.png" "$HOME/calls.log"
grep -q "swaybg -o DP-3 -i $HOME/saved_v.png" "$HOME/calls.log"
}
@test "restore falls back to conf defaults" {
- CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"; CONF_THEME="conf"
+ CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"
: > "$HOME/dh.png"; : > "$HOME/dv.png"
CONF_DEFAULT_H="$HOME/dh.png"; CONF_DEFAULT_V="$HOME/dv.png"
- do_restore ""
+ do_restore
grep -q "swaybg -o DP-1 -i $HOME/dh.png" "$HOME/calls.log"
[ "$(cat "$HOME/.config/wallp/wall_h")" = "$HOME/dh.png" ]
}
@test "set CLI partial sets only V" {
- CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"; CONF_THEME="conf"
+ CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"
: > "$HOME/v.png"
- do_set "" "V=$HOME/v.png"
+ do_set "V=$HOME/v.png"
grep -q "swaybg -o DP-3 -i $HOME/v.png" "$HOME/calls.log"
! grep -q "swaybg -o DP-1" "$HOME/calls.log"
}
-@test "set CLI persists flag theme" {
- CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"; CONF_THEME="conf"
- : > "$HOME/h.png"
- do_set "flagtheme" "H=$HOME/h.png"
- [ "$(cat "$HOME/.config/wallp/theme")" = "flagtheme" ]
-}
-
@test "set with no args and no display errors" {
- CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"; CONF_THEME="conf"
+ CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"
unset WAYLAND_DISPLAY
- run do_set ""
+ run do_set
[ "$status" -eq 1 ]
[[ "$output" == *"no display"* ]]
}
@test "set qarma path applies selected screen" {
- CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"; CONF_THEME="conf"
+ CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3"
export WAYLAND_DISPLAY="wayland-0"
: > "$HOME/picked.png"
# qarma stub: --list returns the screen choice; --file-selection returns a path.
@@ -259,7 +227,7 @@ esac
exit 0
EOF
chmod +x "$STUB_DIR/qarma"
- do_set ""
+ do_set
grep -q "swaybg -o DP-3 -i $HOME/picked.png" "$HOME/calls.log"
! grep -q "swaybg -o DP-1" "$HOME/calls.log"
}
@@ -306,15 +274,6 @@ EOF
[ ! -e "$HOME/.cache/wallp/H.pid" ]
}
-@test "theme flag honored through main with restore" {
- unset WAYLAND_DISPLAY
- mkdir -p "$HOME/.config/wallp"
- printf '%s\n' 'OUTPUT_H=DP-1' 'OUTPUT_V=DP-3' \
- 'DEFAULT_H=/dh.png' 'DEFAULT_V=/dv.png' > "$HOME/.config/wallp/wallp.conf"
- main --restore --theme tflag
- [ "$(cat "$HOME/.config/wallp/theme")" = "tflag" ]
-}
-
@test "missing required binary errors before acting" {
unset WAYLAND_DISPLAY
rm -f "$STUB_DIR/swaybg" # swaybg now absent
diff --git a/wallp b/wallp
index 9480b12..be5ff50 100755
--- a/wallp
+++ b/wallp
@@ -14,7 +14,7 @@ expand_tilde() {
# Parse key=value conf into CONF_* globals. Ignores blanks and #-comments.
# Expands ~ in DEFAULT_* path values. Does not validate (see require_conf_keys).
-CONF_THEME="" CONF_OUTPUT_H="" CONF_OUTPUT_V="" CONF_DEFAULT_H="" CONF_DEFAULT_V=""
+CONF_OUTPUT_H="" CONF_OUTPUT_V="" CONF_DEFAULT_H="" CONF_DEFAULT_V=""
parse_conf() {
local file="$1" line key val
while IFS= read -r line || [ -n "$line" ]; do
@@ -22,7 +22,6 @@ parse_conf() {
key="${line%%=*}"
val="${line#*=}"
case "$key" in
- THEME) CONF_THEME="$val" ;;
OUTPUT_H) CONF_OUTPUT_H="$val" ;;
OUTPUT_V) CONF_OUTPUT_V="$val" ;;
DEFAULT_H) CONF_DEFAULT_H="$(expand_tilde "$val")" ;;
@@ -38,8 +37,6 @@ write_conf_template() {
mkdir -p "$(dirname "$path")"
cat > "$path" <<'EOF'
# wallp config. Fill in real values, then re-run wallp.
-# THEME is optional (defaults to sexy-splurge).
-THEME=sexy-splurge
# Physical output names (see: swaymsg -t get_outputs / wlr-randr)
OUTPUT_H=DP-1
OUTPUT_V=DP-3
@@ -73,28 +70,10 @@ load_conf() {
return 10
fi
parse_conf "$path"
- [ -z "$CONF_THEME" ] && CONF_THEME="sexy-splurge"
require_conf_keys || return 1
return 0
}
-theme_file() { printf '%s\n' "$HOME/.config/wallp/theme"; }
-
-persist_theme() {
- local f; f="$(theme_file)"
- mkdir -p "$(dirname "$f")"
- printf '%s\n' "$1" > "$f"
-}
-
-# Precedence: flag arg > persisted file > CONF_THEME > sexy-splurge.
-resolve_theme() {
- local flag="$1" f; f="$(theme_file)"
- if [ -n "$flag" ]; then printf '%s\n' "$flag"; return; fi
- if [ -s "$f" ]; then head -n1 "$f"; return; fi
- if [ -n "${CONF_THEME:-}" ]; then printf '%s\n' "$CONF_THEME"; return; fi
- printf '%s\n' "sexy-splurge"
-}
-
# Maps logical output (H|V) to physical connector name from config.
output_for() {
case "$1" in
@@ -167,19 +146,11 @@ update_wpaper() {
local wf img link; wf="$(wall_file_for H)"
[ -s "$wf" ] || return 0
img="$(cat "$wf")"
- link="$HOME/.cache/wal/wpaper"
+ link="$HOME/.cache/udt/wpaper"
mkdir -p "$(dirname "$link")"
ln -sf "$img" "$link"
}
-apply_theme() {
- local theme="$1"
- persist_theme "$theme"
- wal --backend colorz -nq --theme "$theme" -o "$HOME/bin/wal.sh"
- command -v notify-send >/dev/null 2>&1 && \
- notify-send -u normal -t 5000 "color theme update" "setting color theme to: $theme"
-}
-
# Pick saved path for a logical output, else its conf default.
restore_path_for() {
local logical="$1" wf; wf="$(wall_file_for "$logical")"
@@ -191,17 +162,23 @@ restore_path_for() {
}
do_restore() {
- local flag_theme="$1" logical file
+ local logical file
for logical in H V; do
file="$(restore_path_for "$logical")"
apply_output "$logical" "$file" || true
done
- finalize "$(resolve_theme "$flag_theme")"
+ finalize
}
finalize() {
update_wpaper
- apply_theme "$1"
+ # Refresh the theme accent from the wallpaper. udt-accent owns the whole
+ # palette: it writes rofi, Hyprland, Firefox, quickshell and Sublime, so
+ # there is no pywal run here to render anything first. Never fatal: a
+ # failure here must not stop the wallpaper from being set.
+ 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 || true
+ fi
}
# Interactive selection via qarma. Populates SET_H/SET_V. Isolated for testing.
@@ -227,7 +204,6 @@ qarma_select() {
}
do_set() {
- local flag_theme="$1"; shift
SET_H="" SET_V=""
if [ "$#" -gt 0 ]; then
parse_set_args "$@" || return 1
@@ -242,7 +218,7 @@ do_set() {
fi
[ -n "$SET_H" ] && { apply_output H "$SET_H" || true; }
[ -n "$SET_V" ] && { apply_output V "$SET_V" || true; }
- finalize "$(resolve_theme "$flag_theme")"
+ finalize
}
show_help() {
@@ -256,7 +232,6 @@ Usage:
wallp --set V=<file> Set vertical screen only
wallp --set H=<f> V=<f> Set both screens
wallp --restore Restore last session (defaults if none)
- wallp --theme <name> Override theme (with --set or --restore)
Config: ~/.config/wallp/wallp.conf"
if [ -n "${WAYLAND_DISPLAY:-}" ] && command -v qarma >/dev/null 2>&1; then
@@ -271,8 +246,7 @@ Config: ~/.config/wallp/wallp.conf"
<tt>wallp --set H=&lt;file&gt;${n}${n}${n}${n}</tt> Set horizontal screen only<br>\
<tt>wallp --set V=&lt;file&gt;${n}${n}${n}${n}</tt> Set vertical screen only<br>\
<tt>wallp --set H=&lt;f&gt; V=&lt;f&gt;${n}</tt> Set both screens<br>\
-<tt>wallp --restore${n}${n}${n}${n}${n}${n}${n}</tt> Restore last session (defaults if none)<br>\
-<tt>wallp --theme &lt;name&gt;${n}${n}${n}${n}${n}</tt> Override theme (with --set or --restore)<br><br>\
+<tt>wallp --restore${n}${n}${n}${n}${n}${n}${n}</tt> Restore last session (defaults if none)<br><br>\
<b>Config:</b> <tt>~/.config/wallp/wallp.conf</tt>"
# --width prevents qarma from wrapping the description column onto new lines.
# (GTK enforces a minimum dialog width, so the window may look wider.)
@@ -282,12 +256,12 @@ Config: ~/.config/wallp/wallp.conf"
fi
}
-# Verify required external binaries are present. swaybg + wal always required;
+# Verify required external binaries are present. swaybg always required;
# qarma required only when GUI selection is needed (caller passes "gui").
# notify-send is optional and not checked here.
require_bins() {
local need_gui="${1:-}" bin
- for bin in swaybg wal; do
+ for bin in swaybg; do
if ! command -v "$bin" >/dev/null 2>&1; then
echo "wallp: required binary '$bin' not found in PATH" >&2
return 1
@@ -301,14 +275,12 @@ require_bins() {
}
main() {
- local action="" flag_theme="" set_args=()
+ local action="" set_args=()
while [ "$#" -gt 0 ]; do
case "$1" in
--help|-h) show_help; return 0 ;;
--set) action="set" ;;
--restore) action="restore" ;;
- --theme) shift; flag_theme="${1:-}";
- [ -z "$flag_theme" ] && { echo "wallp: --theme needs a name" >&2; return 1; } ;;
H=*|V=*) set_args+=("$1") ;;
*) echo "wallp: unknown argument '$1'" >&2; show_help; return 1 ;;
esac
@@ -329,8 +301,8 @@ main() {
if [ "$rc" -ne 0 ]; then return 1; fi
case "$action" in
- set) do_set "$flag_theme" "${set_args[@]}" ;;
- restore) do_restore "$flag_theme" ;;
+ set) do_set "${set_args[@]}" ;;
+ restore) do_restore ;;
esac
}
diff --git a/wallp.conf.example b/wallp.conf.example
index 45a6b55..26cd444 100644
--- a/wallp.conf.example
+++ b/wallp.conf.example
@@ -1,6 +1,4 @@
# wallp config. Copy to ~/.config/wallp/wallp.conf and edit.
-# THEME is optional (defaults to sexy-splurge).
-THEME=sexy-splurge
# Physical output names (swaymsg -t get_outputs / wlr-randr)
OUTPUT_H=DP-1
OUTPUT_V=DP-3