From 4454b0bb0334813d85e7b77fa1a190a973db96d9 Mon Sep 17 00:00:00 2001 From: antistereov Date: Wed, 25 Feb 2026 02:07:48 +0100 Subject: [PATCH] feat(hyprlock): update --- hypr/autostart.conf | 2 ++ hypr/hyprlock.conf | 16 ++++++++-------- hypr/scripts/cover.sh | 26 +++++++++++++++++--------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/hypr/autostart.conf b/hypr/autostart.conf index 07f796f..ea9e6eb 100644 --- a/hypr/autostart.conf +++ b/hypr/autostart.conf @@ -18,4 +18,6 @@ exec-once = ~/.config/hypr/scripts/cover-listener.sh exec-once = gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3-dark' exec-once = gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' +exec-once = curl -s https://zenquotes.io/api/random > ~/.cache/quote.json + exec-once = seafile-applet diff --git a/hypr/hyprlock.conf b/hypr/hyprlock.conf index 286621f..6675b45 100644 --- a/hypr/hyprlock.conf +++ b/hypr/hyprlock.conf @@ -85,22 +85,22 @@ image { label { monitor = - text = cmd[update:1000] playerctl metadata artist + text = cmd[update:1000] playerctl metadata title || jq -r '.[0].q' ~/.cache/quote.json color = rgba(242, 243, 244, 0.8) - font_size = 14 - font_family = Lexend Bold - position = 0, -300 + font_size = 14 + font_family = Lexend + position = 0, -270 halign = center valign = center } label { monitor = - text = cmd[update:1000] playerctl metadata title + text = cmd[update:1000] playerctl metadata artist || jq -r '.[0].a' ~/.cache/quote.json color = rgba(242, 243, 244, 0.8) - font_size = 14 - font_family = Lexend - position = 0, -270 + font_size = 14 + font_family = Lexend Bold + position = 0, -300 halign = center valign = center } diff --git a/hypr/scripts/cover.sh b/hypr/scripts/cover.sh index 4368aee..c135694 100755 --- a/hypr/scripts/cover.sh +++ b/hypr/scripts/cover.sh @@ -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"