Adds media display

This commit is contained in:
Michel Fedde 2025-10-22 01:50:22 +02:00
parent 032cab6ba8
commit ca2fa8dc62
12 changed files with 180 additions and 8 deletions

19
.config/scripts/media.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
EWW_VARIABLE_NAME="media-close-time"
EWW_DISPLAY_TIME=10
case "$1" in
"play-pause" | "stop" | "next" | "previous")
playerctl "$1"
;;
"display")
EWW_DISPLAY_TIME=${2:-10}
;;
*)
echo "Invalid Entry"
exit 1
;;
esac
eww update "$EWW_VARIABLE_NAME=$(($(date +%s) + $EWW_DISPLAY_TIME))"

View file

@ -0,0 +1,12 @@
#!/bin/bash
formatReturn() {
playerctl metadata | jq -R -s -c -r 'split("\n") | map(match("(\\w+) {1}([\\w:]+) {3,}(.+)") | {(.captures[1].string): .captures[2].string}) | add'
}
playerctl --follow metadata | while read line; do
~/.config/scripts/media.sh display 5
formatReturn
done