feat(hyprlock): update
This commit is contained in:
24
waybar/scripts/nowplaying.sh
Executable file
24
waybar/scripts/nowplaying.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
CACHE="$HOME/.cache/waybar-cover.jpg"
|
||||
TMP="$HOME/.cache/waybar-cover.tmp.jpg"
|
||||
|
||||
status=$(playerctl status 2>/dev/null)
|
||||
|
||||
if [ "$status" = "Playing" ]; then
|
||||
artist=$(playerctl metadata artist)
|
||||
title=$(playerctl metadata title)
|
||||
url=$(playerctl metadata mpris:artUrl)
|
||||
|
||||
if [[ "$url" == file://* ]]; then
|
||||
cp "${url#file://}" "$TMP"
|
||||
else
|
||||
curl -sL "$url" -o "$TMP"
|
||||
fi
|
||||
|
||||
mv -f "$TMP" "$CACHE"
|
||||
|
||||
echo "{\"text\": \"$artist - $title\", \"tooltip\": \"$artist - $title\", \"class\": \"playing\", \"alt\": \"$CACHE\"}"
|
||||
else
|
||||
echo "{\"text\": \" \", \"class\": \"stopped\"}"
|
||||
fi
|
||||
Reference in New Issue
Block a user