From 2fb2affea5f4a2994e8d32264a7f67c5e674afe5 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 7 Oct 2026 10:04:26 +0200 Subject: feat(firefox): blur the new tab background The new tab showed the wallpaper verbatim, so it read as a hole onto the desktop. write_firefox now scales the wallpaper to 1920 wide and applies a Gaussian blur (FIREFOX_BLUR, radius 24) with PIL before saving it into FF Ultima's darknix.png slot. Saving through PIL also makes the file a real PNG whatever the wallpaper's format. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 7 ++++--- bin/udt-accent | 22 +++++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 3a7401d..92f8894 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -270,9 +270,10 @@ the terminal palette follows the scheme and never the wallpaper. The 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 `udt-accent` -copies the wallpaper over its `walls/darknix.png` slot; selecting it once +Firefox's new tab shows the wallpaper, blurred so it reads as a page and not +as the desktop. FF Ultima picks the new tab background from a fixed list of +images by pref, and `udt-accent` writes a blurred copy (PIL, `FIREFOX_BLUR`) +over its `walls/darknix.png` slot; selecting it once (`user.theme.wallpaper.darknix` in `about:config`) is the only manual step. A copy, not a symlink: Firefox's sandbox will not follow a link out of the profile, and the new tab stays blank. diff --git a/bin/udt-accent b/bin/udt-accent index 17a225d..8f85b4c 100755 --- a/bin/udt-accent +++ b/bin/udt-accent @@ -19,7 +19,6 @@ import json import math import os import re -import shutil import subprocess import sys import tempfile @@ -66,6 +65,8 @@ PALETTE_RASI = Path.home() / ".config" / "rofi" / "udt" / "palette.rasi" 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" +# Gaussian radius in px at 1920 wide, for the new tab background. +FIREFOX_BLUR = 24 # 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 @@ -396,18 +397,29 @@ def write_colors_json(name, image): def write_firefox(image): - """Copy the wallpaper into FF Ultima's darknix.png new tab slot. + """Write a blurred 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 + Blurred so the new tab reads as Firefox, not as a hole onto the desktop. + A file, 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. """ + from PIL import Image, ImageFilter + + blurred = None for walls in (Path.home() / ".mozilla" / "firefox").glob(f"*/{FIREFOX_WALLS}"): + if blurred is None: + with Image.open(image) as im: + im = im.convert("RGB") + # Detail is blurred away anyway, so 1920 wide is plenty and + # keeps the blur fast on a 4K wallpaper. + im.thumbnail((1920, 1920)) + blurred = im.filter(ImageFilter.GaussianBlur(FIREFOX_BLUR)) dest = walls / "darknix.png" - # A leftover link would make copyfile write through it into the + # A leftover link would make save write through it into the # wallpaper itself. dest.unlink(missing_ok=True) - shutil.copyfile(image, dest) + blurred.save(dest, "PNG") def rewrite(path, pattern, value): -- cgit v1.2.3