feat(hyprlock): update

This commit is contained in:
2026-02-25 02:07:48 +01:00
parent 74dda82f24
commit 4454b0bb03
3 changed files with 27 additions and 17 deletions

View File

@@ -1,15 +1,23 @@
#!/bin/bash
CACHE="$HOME/.cache/nowplaying-cover.jpg"
TMP="$HOME/.cache/nowplaying-cover.tmp.jpg"
url=$(playerctl metadata mpris:artUrl 2>/dev/null)
status=$(playerctl status 2>/dev/null)
# Kein Player aktiv
[ -z "$url" ] && exit 0
# file:// prefix entfernen (Spotify lokal)
if [[ "$url" == file://* ]]; then
cp "${url#file://}" "$CACHE"
else
curl -sL "$url" -o "$CACHE"
if [ "$status" != "Playing" ]; then
rm -f "$CACHE"
exit 0
fi
url=$(playerctl metadata mpris:artUrl)
[ -z "$url" ] && rm -f "$CACHE" && exit 0
if [[ "$url" == file://* ]]; then
cp "${url#file://}" "$TMP"
else
curl -sL "$url" -o "$TMP"
fi
mv -f "$TMP" "$CACHE"