Fixes media control
This commit is contained in:
parent
6e303a2ff8
commit
12d107e3b4
3 changed files with 36 additions and 14 deletions
|
|
@ -15,8 +15,14 @@
|
|||
)
|
||||
)
|
||||
|
||||
(defwidget media-label [text ?class]
|
||||
(label :text {text} :xalign "0" :class {class})
|
||||
(defwidget media-label [text ?header ?icon]
|
||||
(box
|
||||
:visible {strlength(text) > 1}
|
||||
:space-evenly false
|
||||
:spacing 10
|
||||
(image :icon {icon})
|
||||
(label :text {text} :xalign "0" :class {header ? "header" : ""})
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget media-texts []
|
||||
|
|
@ -26,9 +32,9 @@
|
|||
:valign "center"
|
||||
:halign "start"
|
||||
:space-evenly false
|
||||
(media-label :class "header" :text {media-info["xesam:title"]})
|
||||
(media-label :text {media-info["xesam:artist"]})
|
||||
(media-label :text {media-info["xesam:album"]})
|
||||
(media-label :header true :text {media-info["xesam:title"]} :icon "library-music")
|
||||
(media-label :text {media-info["xesam:artist"]} :icon "user-identity")
|
||||
(media-label :text {media-info["xesam:album"] ?: ""} :icon "cd")
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -89,7 +95,7 @@
|
|||
:geometry (geometry
|
||||
:x "10px"
|
||||
:y "50px"
|
||||
:width "512px"
|
||||
:width "0px"
|
||||
:height "10%"
|
||||
:anchor "top right")
|
||||
:stacking "fg"
|
||||
|
|
|
|||
|
|
@ -11,11 +11,12 @@
|
|||
}
|
||||
|
||||
label {
|
||||
font-size: 1.5rem;
|
||||
&.header {
|
||||
font-size: 2rem;
|
||||
font-weight: bolder;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-size: 1.5rem;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
progressbar {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
formatReturn() {
|
||||
targetArtPath="/tmp/.eww.media-art.$(tr -dc 'a-zA-Z0-9' </dev/urandom | head -c 10)"
|
||||
currentArtUrl=""
|
||||
currentArtPath=""
|
||||
|
||||
updateArtPath() {
|
||||
local url="$1"
|
||||
|
||||
if [[ "$url" == "$currentArtUrl" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
currentArtUrl="$url"
|
||||
currentArtPath="/tmp/.eww.media-art.$(tr -dc 'a-zA-Z0-9' </dev/urandom | head -c 10)"
|
||||
|
||||
rm /tmp/.eww.media-art.*
|
||||
|
||||
curl $(playerctl metadata mpris:artUrl) -o "$targetArtPath" >/dev/null
|
||||
curl "$url" -o "$currentArtPath" >/dev/null
|
||||
}
|
||||
|
||||
playerctl metadata | jq -R -s -c -r --arg artPath "$targetArtPath" 'split("\n") | map(match("(\\w+) {1}([\\w:]+) {3,}(.+)") | {(.captures[1].string): .captures[2].string}) | add | .["mpris:artUrl"] = $artPath'
|
||||
formatReturn() {
|
||||
|
||||
updateArtPath $(playerctl metadata mpris:artUrl)
|
||||
|
||||
playerctl metadata | jq -R -s -c -r --arg artPath "$currentArtPath" 'split("\n") | map(match("(\\w+) {1}([\\w:]+) {3,}(.+)") | {(.captures[1].string): .captures[2].string}) | add | .["mpris:artUrl"] = $artPath'
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue