fix mpris to fixed width
This commit is contained in:
parent
760558d214
commit
fcaf744efc
@ -10,11 +10,13 @@ Rectangle {
|
|||||||
visible: root.spotify != null
|
visible: root.spotify != null
|
||||||
radius: implicitHeight / 2
|
radius: implicitHeight / 2
|
||||||
color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
color: clickHandler.containsMouse ? Colors.primaryContainer : Colors.surfaceContainer
|
||||||
implicitWidth: root.implicitWidth + 20
|
|
||||||
implicitHeight: Settings.config.barHeight - 10
|
implicitHeight: Settings.config.barHeight - 10
|
||||||
|
implicitWidth: 400
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
width: Math.min(statusRow.implicitWidth, parent.width - 20)
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
property var spotify: root.getSpotify()
|
property var spotify: root.getSpotify()
|
||||||
function getSpotify() {
|
function getSpotify() {
|
||||||
for (let i = 0; i < Mpris.players.values.length; i++) {
|
for (let i = 0; i < Mpris.players.values.length; i++) {
|
||||||
@ -29,14 +31,20 @@ Rectangle {
|
|||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: statusRow
|
id: statusRow
|
||||||
|
anchors.fill: parent
|
||||||
spacing: 5
|
spacing: 5
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
property var combinedText: root.spotify != null ? root.spotify.trackArtist + " - " + root.spotify.trackTitle : ""
|
property var combinedText: root.spotify != null ? root.spotify.trackArtist + " - " + root.spotify.trackTitle : ""
|
||||||
property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : ""
|
property var status: root.spotify != null ? !root.spotify.isPlaying ? "play_arrow" : "pause" : ""
|
||||||
CustomText {
|
CustomText {
|
||||||
id: mprisText
|
id: mprisText
|
||||||
|
Layout.leftMargin: 10
|
||||||
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 2
|
Layout.topMargin: 2
|
||||||
text: root.spotify != null ? parent.combinedText : ""
|
text: root.spotify != null ? parent.combinedText : ""
|
||||||
|
elide: Text.ElideRight
|
||||||
|
clip: true
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
}
|
}
|
||||||
CustomIcon {
|
CustomIcon {
|
||||||
id: mprisStatus
|
id: mprisStatus
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user