aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AGENTS.md8
-rwxr-xr-xbin/udt-accent19
-rwxr-xr-xinstall.sh9
3 files changed, 23 insertions, 13 deletions
diff --git a/AGENTS.md b/AGENTS.md
index c1ab004..3a7401d 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -271,11 +271,11 @@ write lands after `wallp` has already run `wal --theme`, so it wins; reorder
those two and pywal's wallpaper-derived colours come back.
Firefox's new tab shows the wallpaper itself, not a colour. FF Ultima picks
-the new tab background from a fixed list of images by pref, and `install.sh`
-links its `walls/darknix.png` slot to `~/.cache/udt/wpaper`; selecting it once
+the new tab background from a fixed list of images by pref, and `udt-accent`
+copies the wallpaper over its `walls/darknix.png` slot; selecting it once
(`user.theme.wallpaper.darknix` in `about:config`) is the only manual step.
-Firefox revalidates the file on each new tab, so a wallpaper change reaches a
-running browser without a restart.
+A copy, not a symlink: Firefox's sandbox will not follow a link out of the
+profile, and the new tab stays blank.
Not everything tracks the wallpaper. rofi, quickshell, Hyprland borders,
hyprlock's border (through `~/.cache/udt/hyprlock-border.conf`), Sublime's
diff --git a/bin/udt-accent b/bin/udt-accent
index 69698d1..2dfc9a0 100755
--- a/bin/udt-accent
+++ b/bin/udt-accent
@@ -19,6 +19,7 @@ import json
import math
import os
import re
+import shutil
import subprocess
import sys
import tempfile
@@ -63,6 +64,8 @@ PALETTE_RASI = Path.home() / ".config" / "rofi" / "udt" / "palette.rasi"
# 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"
+# FF Ultima's new tab background slots. darknix.png is the one udt fills.
+FIREFOX_WALLS = "chrome/theme/color-schemes/walls"
# The SDDM theme's live palette. ~/.cache is 0700 and unreachable to the sddm
# user, ~/.local/share is 0755, so the file has to live here. Root symlinks
@@ -387,6 +390,21 @@ def write_colors_json(name, image):
subprocess.run(["pywalfox", "update"], capture_output=True, check=False)
+def write_firefox(image):
+ """Copy the wallpaper into FF Ultima's darknix.png new tab slot.
+
+ A copy, not a link: Firefox's sandbox refuses to follow a symlink out of
+ the profile, and the new tab shows nothing. Every profile without FF
+ Ultima is skipped.
+ """
+ for walls in (Path.home() / ".mozilla" / "firefox").glob(f"*/{FIREFOX_WALLS}"):
+ dest = walls / "darknix.png"
+ # A leftover link would make copyfile write through it into the
+ # wallpaper itself.
+ dest.unlink(missing_ok=True)
+ shutil.copyfile(image, dest)
+
+
def rewrite(path, pattern, value):
"""Replace group 1's tail in the first line matching pattern with value.
@@ -541,6 +559,7 @@ def main(image):
write_sublime(name)
write_sddm(name, image)
write_colors_json(name, image)
+ write_firefox(image)
# Before the helpers below start, which build and stage these two.
write_grub(name)
write_homepage(name)
diff --git a/install.sh b/install.sh
index b0fd835..7a78f80 100755
--- a/install.sh
+++ b/install.sh
@@ -123,15 +123,6 @@ fi
mkdir -p "$HOME/.cache/wal"
ln -sfn "$HOME/.cache/udt/colors.json" "$HOME/.cache/wal/colors.json"
-# Firefox's new tab background. FF Ultima picks it from a fixed list of
-# images by pref; its darknix.png slot is pointed at the wallpaper udt-accent
-# tracks, so selecting it once (user.theme.wallpaper.darknix in about:config)
-# makes the new tab follow every wallpaper change. Skipped per profile
-# without FF Ultima.
-for walls in "$HOME"/.mozilla/firefox/*/chrome/theme/color-schemes/walls; do
- [ -d "$walls" ] && ln -sfn "$HOME/.cache/udt/wpaper" "$walls/darknix.png"
-done
-
# The rofi menus are bound by name in hypr-theme's keybindings, so they keep
# the names they had when they lived loose in ~/bin.
for f in udt-accent udt-grub udt-keyboard udt-steps udt-palette udt-machine-name udt-powermenu.sh udt-launcher.sh qar-scrotmenu.sh; do