Misc fixes

This commit is contained in:
Geoffrey Frogeye 2024-11-07 14:47:39 +01:00
parent 0d1c2f1975
commit 22b844df2c
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
3 changed files with 75 additions and 71 deletions

View file

@ -874,7 +874,7 @@ class MprisProvider(Section, ThreadedUpdater):
"{{ playerName }} {{ status }}",
"{{ album }}",
"{{ artist }}",
"{{ duration(position) }}|{{ duration(mpris:length) }}" " {{ title }}",
"{{ duration(position) }}/{{ duration(mpris:length) }}" " {{ title }}",
]
# nf-fd icons don't work (UTF-16?)
@ -894,6 +894,8 @@ class MprisProvider(Section, ThreadedUpdater):
3: "",
}
MAX_SECTION_LENGTH = 40
def __init__(self, theme: int | None = None):
ThreadedUpdater.__init__(self)
Section.__init__(self, theme)
@ -926,6 +928,8 @@ class MprisProvider(Section, ThreadedUpdater):
if text:
if i in self.ICONS:
text = f"{self.ICONS[i]} {text}"
if len(text) > self.MAX_SECTION_LENGTH:
text = text[: self.MAX_SECTION_LENGTH - 1] + ""
section.updateText(text)
else:
section.updateText(None)