eww: Use scroll widgets to ensure media title and artist do not overflow

This could previously cause the sidebar to enlarge.
This commit is contained in:
elenapan 2025-04-01 17:08:52 +03:00
parent 9ec3e14841
commit 836cfac547
2 changed files with 37 additions and 25 deletions

View file

@ -234,6 +234,21 @@ window .sidebar {
}
}
.media-info-text {
margin: 0 40px;
}
.circular-symbol-with-text {
&.media-title {
margin-top: dpi(27px);
margin-bottom: dpi(17px);
}
&.media-artist {
margin-bottom: dpi(20px);
}
}
.visualizer {
min-height: dpi(66px);
.invisible-slider {
@ -556,17 +571,6 @@ window .sidebar {
}
.circular-symbol-with-text {
&.media-title {
margin-top: dpi(27px);
margin-bottom: dpi(17px);
}
&.media-artist {
margin-bottom: dpi(20px);
}
}
.weather {
margin-bottom: dpi(30px);
}

View file

@ -269,20 +269,28 @@
))
)
; Artist and title (truncated so that the eww window does not grow)
; Character limit should be adjusted according to font family, font size,
; and desired max length of the eww window
(circular-symbol-with-text
:extra-class "media-title"
:symbol ""
:text-left "${strlength(media-json.title) > 35 ? "${substring(media-json.title, 0, 32)}..." : media-json.title}"
:text-right "")
(circular-symbol-with-text
:extra-class "media-artist"
:symbol ""
:text-left "${strlength(media-json.artist) > 35 ? "${substring(media-json.artist, 0, 32)}..." : media-json.artist}"
:text-right "")
; Artist and title inside scroll containers to prevent the sidebar
; from growing when the text is too long
(box :class "media-info-text"
:orientation "vertical"
:space-evenly false
(scroll
:hscroll true
:vscroll false
(circular-symbol-with-text
:extra-class "media-title"
:symbol ""
:text-left "${media-json.title}"
:text-right ""))
(scroll
:hscroll true
:vscroll false
(circular-symbol-with-text
:extra-class "media-artist"
:symbol ""
:text-left "${media-json.artist}"
:text-right ""))
)
(media-progress-visualizer)