aboutsummaryrefslogtreecommitdiffstats
path: root/bin/udt-accent
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-07 10:04:26 +0200
committerDanilo M. <danix@danix.xyz>2026-10-07 10:04:26 +0200
commit2fb2affea5f4a2994e8d32264a7f67c5e674afe5 (patch)
treea0416eba4fa83d8127188992ba269056cf6634d3 /bin/udt-accent
parent205633a064a560c84989d50cb92237d9173e4d6a (diff)
downloadunified-desktop-theme-2fb2affea5f4a2994e8d32264a7f67c5e674afe5.tar.gz
unified-desktop-theme-2fb2affea5f4a2994e8d32264a7f67c5e674afe5.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'bin/udt-accent')
-rwxr-xr-xbin/udt-accent22
1 files changed, 17 insertions, 5 deletions
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):