diff --git a/Shell/Overlays/MprisOverlay.qml b/Shell/Overlays/MprisOverlay.qml index 7426921..f5d5e36 100644 --- a/Shell/Overlays/MprisOverlay.qml +++ b/Shell/Overlays/MprisOverlay.qml @@ -31,6 +31,10 @@ PanelWindow { id: songItem property bool linger: false + function showSongOverlay() { + linger = true; + hideTimer.restart(); + } Timer { id: hideTimer @@ -39,15 +43,31 @@ PanelWindow { onTriggered: songItem.linger = false } - property bool hasSong: (index === 0 && modelData.dbusName.startsWith("org.mpris.MediaPlayer2.chromium.instance") && modelData.trackTitle !== "" && modelData.trackArtist !== "") + property string artistText: { + if (modelData.trackArtist === undefined || modelData.trackArtist === null) + return ""; + const text = String(modelData.trackArtist); + return text === "" ? "" : text; + } + property bool hasSong: modelData.trackTitle !== "" + property string displayText: { + if (!hasSong) + return ""; + if (artistText !== "") + return "♪ " + artistText + " - " + modelData.trackTitle; + return "♪ " + modelData.trackTitle; + } property bool active: hasSong && linger onHasSongChanged: { - if (hasSong) { - linger = true; - hideTimer.restart(); - } + if (hasSong) + showSongOverlay(); + } + + onDisplayTextChanged: { + if (hasSong) + showSongOverlay(); } visible: opacity > 0 @@ -116,7 +136,7 @@ PanelWindow { Text { x: 1 y: 1 - text: "♪ " + modelData.trackArtist + " - " + modelData.trackTitle + text: songItem.displayText font.family: "8bitoperator JVE" font.pixelSize: 32 font.letterSpacing: 1 @@ -130,7 +150,7 @@ PanelWindow { Text { x: 0 y: 0 - text: "♪ " + modelData.trackArtist + " - " + modelData.trackTitle + text: songItem.displayText font.family: "8bitoperator JVE" font.pixelSize: 32 font.letterSpacing: 1 diff --git a/Shell/Windows/QuickSettings/QuickSettingsApp.qml b/Shell/Windows/QuickSettings/QuickSettingsApp.qml index 246bfa0..00cc9a7 100644 --- a/Shell/Windows/QuickSettings/QuickSettingsApp.qml +++ b/Shell/Windows/QuickSettings/QuickSettingsApp.qml @@ -38,8 +38,12 @@ Item { } function menuLength() { + if (root.inBluetoothMenu && bluetoothRepeater) + return bluetoothRepeater.count; if (!menuModel) return 0; + if (typeof menuModel.count === "function") + return menuModel.count(); if (menuModel.count !== undefined) return menuModel.count; if (menuModel.length !== undefined)