nexoniarz-config-nixos/modules/scripts/wallpaper-thumbs.sh
Nexoniarz aa89dd729c Redesign Display Settings, Wallpapers, Booru; add System Monitor, Weather
Display Settings: drag-to-arrange multi-monitor canvas with edge
snapping (locked when only one screen is connected), 8/10-bit depth,
color management presets (sRGB/Wide/EDID/HDR+EDID), SDR
brightness/saturation, ICC profile path, VRR toggle. display-set now
takes a single pre-built descriptor instead of a fixed positional arg
list, since Hyprland's monitor keyword grew well past that.

Wallpapers: fixed the current-wallpaper highlight never loading on
open, added real first-frame thumbnails for animated wallpapers
(wallpaper-thumbs + ffmpeg), bigger 2-column grid, filename filter.

Booru: separate downloads folder from Wallpapers so browsing doesn't
clutter the wallpaper picker, bigger grid, Safe/Moderate/Explicit
rating tiers replacing the old binary toggle, sort order (Newest/
Score/Random). Fixed pagination being completely broken (a Flow
anchor violation was silently disabling the whole layout) and
Danbooru's Random sort (order:random tag times out server-side --
switched to their random=true endpoint for that case).

Wi-Fi panel: added a "Scanning.../No networks found" state and a
manual rescan button -- previously showed nothing either way, making
"still scanning" indistinguishable from a real failure.

Bluetooth: auto-scans on open like Wi-Fi now, instead of requiring a
manual click every time.

New: System Monitor panel (CPU/RAM/GPU/VRAM/disk usage, NVIDIA or AMD
detected automatically) and Weather panel (IP-geolocated or a typed
city, current + hourly forecast, Open-Meteo, no API key) with a
compact taskbar badge.
2026-08-30 20:55:06 +02:00

25 lines
1 KiB
Shell

#!/usr/bin/env bash
# Generates (or reuses) a cached preview JPEG for each animated wallpaper
# — first frame ~1s in, to skip a common black/fade intro on most clips —
# so the Wallpapers panel can show a real thumbnail instead of a generic
# play icon. Prints "<source path>\t<thumbnail path>" per file on stdout
# once it's ready, so the caller (LeftFlyout.qml) never has to
# independently reconstruct the cache filename — it's a hash of the
# source path, chosen only to keep filenames short/safe, not something
# QML needs to know how to derive.
set -euo pipefail
cache_dir="${1:?usage: wallpaper-thumbs <cache-dir> <file...>}"
shift
mkdir -p "$cache_dir"
for file in "$@"; do
[ -f "$file" ] || continue
name="$(printf '%s' "$file" | sha1sum | cut -d' ' -f1)"
thumb="$cache_dir/$name.jpg"
if [ ! -f "$thumb" ] || [ "$file" -nt "$thumb" ]; then
ffmpeg -y -ss 00:00:01 -i "$file" -frames:v 1 -vf "scale=320:-1" "$thumb" \
> /dev/null 2>&1 || true
fi
[ -f "$thumb" ] && printf '%s\t%s\n' "$file" "$thumb"
done