eww: refactor and improved experience with media widgets

This commit is contained in:
retrozinndev
2024-12-21 13:17:51 -03:00
parent 5bc04e4dff
commit 9b8f81417f
9 changed files with 39 additions and 30 deletions
+5 -5
View File
@@ -4,11 +4,11 @@
(defwidget media []
(eventbox :onhover "${EWW_CMD} update media_reveal_controls=true"
:onhoverlost "${EWW_CMD} update media_reveal_controls=false"
:visible { json_media.title == "null" && json_media.artist == "null" ?
false
:
"${ active_window.class =~ json_media.player || active_window.title =~ json_media.title ? false : true }"
}
:visible { json_media == "" ||
(active_window.class =~ json_media.player &&
active_window.title =~ json_media.title) ?
false : true
}
:onclick "sh scripts/eww-window.sh toggle floating-media"
:class "mediaplayer-eventbox"
@@ -1,24 +1,27 @@
(defwidget big-media [ album-background ?player-info ]
(box :class "big-media ${ album-background == true ? 'album-bg' : '' }"
:style { album-background == true ? "background-image: image(url('${json_media.artUrl}'))" : "" }
:visible { json_media.title != "null" && json_media.artist != "null" ? true : false }
(defwidget big-media [ show-album-bg show-album-image ?album-image-size ?style-background-color ?visible ]
(box :class "big-media ${ show-album-bg ? 'album-bg' : '' } ${ show-album-image ? 'album-image' : '' }"
:style "${ show-album-bg ? 'background-image: image(url(\"${json_media.artUrl}\"))' : '' } ${
style-background-color != '' ? 'background-color: ${style-background-color}' : '' }"
:visible { visible ? true : false}
:space-evenly false
:orientation "vertical"
(box :orientation "horizontal"
:space-evenly false
:class "media"
:space-evenly false
:class "media"
(box :class "album-image"
:width 98
:height 87
: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}'));"
:valign "center")
:valign "center"
:visible { show-album-image ? true : false })
(box :orientation "vertical"
:space-evenly false
:class "right"
:hexpand true
:valign "center"
(box :class "media-info"
:space-evenly false
+2 -2
View File
@@ -45,8 +45,8 @@
(label :class "summary"
:text "${summary}"
:xalign 0
:show-truncated true
:halign "start")
:halign "start"
:show-truncated true)
(label :class "body"
:markup "${body}"