eww(mediaplayer): add image path support for album art

This commit is contained in:
retrozinndev
2025-01-09 22:50:24 -03:00
parent 0e7f0cd3fb
commit a14034035e
10 changed files with 32 additions and 102 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
(defwidget clock []
(box :class "clock"
:tooltip { formattime(EWW_TIME, "%A, %B %d") }
:tooltip { day_name + ", " + month_name + formattime(EWW_TIME, " %d") }
(eventbox :onclick "sh scripts/eww-window.sh toggle calendar-window"
:class '${ window_state_calendar-window == "open" ? "cal-open" : "" } button'
@@ -10,7 +10,7 @@
(label :text "󰸗"
:class "icon")
(label :text "${ formattime(EWW_TIME, "%A") }")
(label :text "${day_name}")
(revealer :reveal { window_state_calendar-window == "closed" }
:transition "slideright"
+2
View File
@@ -6,10 +6,12 @@
:space-evenly false
(box :class "cpu"
:visible { cpu == "" || cpu ? true : false }
:tooltip { "CPU: " + arraylength(EWW_CPU?.cores) + " Threads" }
(label :text " ${ round(EWW_CPU?.avg, 0) }%")
)
(box :class "memory"
:visible { memory == "" || memory ? true : false }
:tooltip { "Total Memory: " + round(EWW_RAM?.total_mem / 1000000000, 1) + " GiB(s)" }
(label :text " ${ round(EWW_RAM?.used_mem_perc, 0) }%")
)
)
+1
View File
@@ -45,6 +45,7 @@
(button :class "url"
:onclick "wl-copy '${json_media.url}'"
:tooltip "Copy link to Clipboard"
:visible { json_media != "" && json_media.url != "null" }
"󰌷")
(button :class "previous"
:onclick "playerctl previous --player=${json_media.player}"
+9 -13
View File
@@ -1,9 +1,9 @@
(defwidget big-media [ show-album-bg show-album-image ?album-image-size ?style ?visible ]
(box :class "big-media ${ show-album-bg ? 'album-bg' : '' } ${ show-album-image ? 'album-image' : '' }"
:style "${ show-album-bg ? 'background-image: url(\"${json_media.artUrl}\");' : '' } ${style}"
:visible { visible == "" ? true : "${ visible ? true : false }" }
:space-evenly false
:orientation "vertical"
(box :class "big-media ${ show-album-bg ? 'album-bg' : '' } ${ show-album-image ? 'album-image' : '' }"
:style "${ show-album-bg ? "background-image: url(\"${ json_media.artUrl =~ "^(http(.*)://(.*))$" ? json_media.artUrl : "${ "${ json_media.artUrl =~ "^(file://(.*))$" ? '' : 'file://' }" + json_media.artUrl }" }\")" : "" }; ${style}"
:visible { visible == false ? false : true }
:space-evenly false
:orientation "vertical"
(box :orientation "horizontal"
:space-evenly false
@@ -12,32 +12,28 @@
(box :class "album-image"
:width { album-image-size != "" ? album-image-size : 98 }
:height { album-image-size != "" ? "${album-image-size - 11}" : 87 }
:style "background-image: image(url('${json_media.artUrl}'));"
:style "background-image: url('${ json_media.artUrl =~ "^(http(.*)://(.*))$" ? json_media.artUrl : "${ "${ json_media.artUrl =~ "^(file://(.*))$" ? '' : 'file://' }" + json_media.artUrl }" }');"
:valign "center"
:visible { show-album-image ? true : false })
:visible { json_media.artUrl == "null" || !show-album-image ? false : true })
(box :orientation "vertical"
:space-evenly false
:class "right"
:hexpand true
:valign "center"
(box :class "media-info"
:space-evenly false
:halign "fill"
:orientation "vertical"
(label :class "title"
:text "${json_media.title}"
:xalign 0
:wrap false
:hexpand true
:limit-width 40
:show-truncated true)
(label :class "artist"
:text "${json_media.artist}"
:xalign 0
:wrap false
:hexpand true
:limit-width 40
:show-truncated true)
)