This commit is contained in:
2026-02-28 20:13:03 +02:00
parent 65b87cb9c6
commit 71c32d82ec
2 changed files with 31 additions and 7 deletions

View File

@@ -31,6 +31,10 @@ PanelWindow {
id: songItem id: songItem
property bool linger: false property bool linger: false
function showSongOverlay() {
linger = true;
hideTimer.restart();
}
Timer { Timer {
id: hideTimer id: hideTimer
@@ -39,15 +43,31 @@ PanelWindow {
onTriggered: songItem.linger = false 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 property bool active: hasSong && linger
onHasSongChanged: { onHasSongChanged: {
if (hasSong) { if (hasSong)
linger = true; showSongOverlay();
hideTimer.restart(); }
}
onDisplayTextChanged: {
if (hasSong)
showSongOverlay();
} }
visible: opacity > 0 visible: opacity > 0
@@ -116,7 +136,7 @@ PanelWindow {
Text { Text {
x: 1 x: 1
y: 1 y: 1
text: "♪ " + modelData.trackArtist + " - " + modelData.trackTitle text: songItem.displayText
font.family: "8bitoperator JVE" font.family: "8bitoperator JVE"
font.pixelSize: 32 font.pixelSize: 32
font.letterSpacing: 1 font.letterSpacing: 1
@@ -130,7 +150,7 @@ PanelWindow {
Text { Text {
x: 0 x: 0
y: 0 y: 0
text: "♪ " + modelData.trackArtist + " - " + modelData.trackTitle text: songItem.displayText
font.family: "8bitoperator JVE" font.family: "8bitoperator JVE"
font.pixelSize: 32 font.pixelSize: 32
font.letterSpacing: 1 font.letterSpacing: 1

View File

@@ -38,8 +38,12 @@ Item {
} }
function menuLength() { function menuLength() {
if (root.inBluetoothMenu && bluetoothRepeater)
return bluetoothRepeater.count;
if (!menuModel) if (!menuModel)
return 0; return 0;
if (typeof menuModel.count === "function")
return menuModel.count();
if (menuModel.count !== undefined) if (menuModel.count !== undefined)
return menuModel.count; return menuModel.count;
if (menuModel.length !== undefined) if (menuModel.length !== undefined)