mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 03:00:47 +00:00
feat: fix wallpapers
This commit is contained in:
parent
c2e589011f
commit
076db608b3
7 changed files with 15 additions and 13 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 343 KiB |
BIN
assets/wallpapers/topography-dark.png
Normal file
BIN
assets/wallpapers/topography-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 324 KiB |
BIN
assets/wallpapers/topography-light.png
Normal file
BIN
assets/wallpapers/topography-light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
|
|
@ -62,11 +62,11 @@ let
|
||||||
};
|
};
|
||||||
wallpapers = {
|
wallpapers = {
|
||||||
dir = "${config.home.homeDirectory}/Pictures/Screensavers";
|
dir = "${config.home.homeDirectory}/Pictures/Screensavers";
|
||||||
dark = "${config.home.homeDirectory}/Pictures/Screensavers/wallpaper-dark.jpg";
|
dark = "${config.home.homeDirectory}/Pictures/Screensavers/wallpaper-dark.png";
|
||||||
light = "${config.home.homeDirectory}/Pictures/Screensavers/wallpaper-light.jpg";
|
light = "${config.home.homeDirectory}/Pictures/Screensavers/wallpaper-light.png";
|
||||||
current = "${config.home.homeDirectory}/Pictures/Screensavers/wallpaper.jpg";
|
current = "${config.home.homeDirectory}/Pictures/Screensavers/wallpaper.png";
|
||||||
staticDark = ../assets/wallpapers/topography-dark.jpg;
|
staticDark = ../assets/wallpapers/topography-dark.png;
|
||||||
staticLight = ../assets/wallpapers/topography-light.jpg;
|
staticLight = ../assets/wallpapers/topography-light.png;
|
||||||
generation = wallpaperGeneration;
|
generation = wallpaperGeneration;
|
||||||
};
|
};
|
||||||
paths = {
|
paths = {
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ set_wallpaper() {
|
||||||
# macOS caches wallpaper data by file path - copy to a unique temp path
|
# macOS caches wallpaper data by file path - copy to a unique temp path
|
||||||
# so macOS is forced to read the new image data
|
# so macOS is forced to read the new image data
|
||||||
wp_dir=$(dirname "$wp_resolved")
|
wp_dir=$(dirname "$wp_resolved")
|
||||||
wp_tmp="${wp_dir}/.wallpaper-active-$$.jpg"
|
wp_tmp="${wp_dir}/.wallpaper-active-$$.png"
|
||||||
rm -f "${wp_dir}"/.wallpaper-active-*.jpg 2>/dev/null || true
|
rm -f "${wp_dir}"/.wallpaper-active-*.png 2>/dev/null || true
|
||||||
cp "$wp_resolved" "$wp_tmp"
|
cp "$wp_resolved" "$wp_tmp"
|
||||||
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"${wp_tmp}\"" >/dev/null 2>&1 || true
|
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"${wp_tmp}\"" >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,8 @@ CONTOUR_LEVELS: int = max(1, int(CONTOURS.get("levels", 20)))
|
||||||
# cozybox palette - matches lib/theme.nix
|
# cozybox palette - matches lib/theme.nix
|
||||||
THEMES: dict[str, dict[str, Rgb]] = {
|
THEMES: dict[str, dict[str, Rgb]] = {
|
||||||
"dark": {
|
"dark": {
|
||||||
"bg": (0x18, 0x18, 0x18),
|
"bg": (0x00, 0x00, 0x00),
|
||||||
"line": (0x2d, 0x2d, 0x2d),
|
"line": (0x1a, 0x1a, 0x1a),
|
||||||
"label": (0xFF, 0xFF, 0xFF),
|
"label": (0xFF, 0xFF, 0xFF),
|
||||||
},
|
},
|
||||||
"light": {
|
"light": {
|
||||||
|
|
@ -451,14 +451,16 @@ def gen() -> None:
|
||||||
if LABEL_ENABLED and font is not None:
|
if LABEL_ENABLED and font is not None:
|
||||||
draw = ImageDraw.Draw(img)
|
draw = ImageDraw.Draw(img)
|
||||||
draw.text((LABEL_MARGIN_X, H - LABEL_MARGIN_BOTTOM), label, fill=colors["label"], font=font)
|
draw.text((LABEL_MARGIN_X, H - LABEL_MARGIN_BOTTOM), label, fill=colors["label"], font=font)
|
||||||
out_path = os.path.join(DIR, f"wallpaper-{theme_name}.jpg")
|
out_path = os.path.join(DIR, f"wallpaper-{theme_name}.png")
|
||||||
img.save(out_path, quality=95)
|
if os.path.exists(out_path):
|
||||||
|
os.remove(out_path)
|
||||||
|
img.save(out_path)
|
||||||
log(f"wrote theme={theme_name} path={out_path}")
|
log(f"wrote theme={theme_name} path={out_path}")
|
||||||
|
|
||||||
link = os.path.join(DIR, "wallpaper.jpg")
|
link = os.path.join(DIR, "wallpaper.png")
|
||||||
if os.path.lexists(link):
|
if os.path.lexists(link):
|
||||||
os.unlink(link)
|
os.unlink(link)
|
||||||
target = os.path.join(DIR, f"wallpaper-{theme}.jpg")
|
target = os.path.join(DIR, f"wallpaper-{theme}.png")
|
||||||
os.symlink(target, link)
|
os.symlink(target, link)
|
||||||
log(f"finish status=ok target={target} link={link}")
|
log(f"finish status=ok target={target} link={link}")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue