Closed AndydeCleyre closed 4 years ago
Use https://store.kde.org/p/998887/, though it seems opening that widget's config freezes plasma (infinite loop?) so if you want to edit it, open up the following file after installing it:
~/.local/share/plasma/plasmoids/org.kde.plasma.mediacontrollercompact/contents/ui/configGeneral.qml
Then add id: pageColumn
to the first ColumnLayout
and change implicitWidth: mainColumn.implicitWidth
to implicitWidth: pageColumn.implicitWidth
.
Restart plasma with killall plasmashell; kstart5 plasmashell
to reload the panel.
You can then open up ExpandedRepresentation.qml
and delete the buttons. Basically delete the Column { id: playerControls }
and everything after it.
Just make sure you don't delete the final 3 closing tags.
As for what actually controls the widget's width in a panel, the Layout.preferredWidth: output.implicitWidth
in the Plasmoid.fullRepresentation
item is what you need to look at.
Use Layout.preferredWidth: 234
, or Layout.preferredWidth: 234 * units.devicePixelRatio
if you want to code properly for HiDPI, will make it 234px wide.
https://github.com/Zren/plasma-applet-commandoutput/blob/master/package/contents/ui/main.qml#L94
I don't think what you've suggested will function as well for me as what I have. My playback information falls back to information reported by Last.fm if no local players are found (so it is accurate even if some other device is playing the music).
For reference, this is the script I wish I could use colors with (see the def and commented call for colorize
), without having this applet/Qt delete characters from the middle.
The now_playing
function can be mocked by having it return
{
'title': "A Great Song",
'artist': "A Pretty Good Musician",
'album': "A Hit or Miss Album",
'status': "Playing"
}
Hey, it seems that if the new official color setting is used, white space is preserved!
I use this applet to display currently playing track information, and want to control the width, because if my panel changes size every few seconds it distracts me from work. So I use a monospace font, and implement a "resize" function, which pads the outside with spaces, or truncates the content.
The first problem is the auto-trimming (like Python's
str.strip
), but I work around that by adding some outer character, like-
to either side.That worked until I discovered I could color the content, using html-like markup (Qstring?). So for example, the script might alternately be outputting these two lines:
Both strings are exactly the same length. The resulting presentation is colored. But the consecutive spaces are "squeezed" (even though they are not at the beginning or end of the string).
So the representation (colored) becomes:
They differ in size by two characters, because the consecutive spaces in the middle of the string have been reduced to a single space per grouping.
How can we prevent these interventions?