fixed music player hover inconsistency and irregular album art sizing

This commit is contained in:
2026-08-24 13:32:58 +01:00
parent 84dae3177e
commit 3c493fe5f8

View File

@@ -66,9 +66,11 @@ Container {
StateChangeScript { StateChangeScript {
script: { script: {
root.stack.replace(mprisToast); root.stack.replace(mprisToast);
if (root.hovered != true) {
mprisTimer.restart(); mprisTimer.restart();
} }
} }
}
}, },
State { State {
name: "logout" name: "logout"
@@ -145,7 +147,7 @@ Container {
Connections { Connections {
function onTrackChanged() { function onTrackChanged() {
if (root.overriden != true) { if (root.overriden != true && root.hovered != true) {
root.overriden = true; root.overriden = true;
root.mpris = true; root.mpris = true;
} }
@@ -197,7 +199,7 @@ Container {
color: Colors.peach, color: Colors.peach,
text: "󰗽", text: "󰗽",
key: Qt.Key_E, key: Qt.Key_E,
command: ["hyprctl", "dispatch", "'hl.dsp.exit()'"] command: ["hyprctl", "dispatch", "hl.dsp.exit()"]
}, },
{ {
color: Colors.yellow, color: Colors.yellow,
@@ -276,7 +278,7 @@ Container {
TapHandler { TapHandler {
onTapped: { onTapped: {
Quickshell.execDetached(logoutButtonRoot.modelData.command) Quickshell.execDetached(logoutButtonRoot.modelData.command);
} }
} }
@@ -445,9 +447,22 @@ Container {
implicitWidth: mprisToastRoot.getInnerHeight() implicitWidth: mprisToastRoot.getInnerHeight()
radius: 5 radius: 5
IconImage { Image {
anchors.fill: parent anchors.centerIn: parent
source: mprisToastRoot.trackInfo["albumArt"]
// Non-blocking load for local or remote track art
asynchronous: true
// Optional: clips the overflowing parts of the cropped image to the 1:1 box
clip: true
// Zoom and crop from the center to fill the square completely
fillMode: Image.PreserveAspectCrop
height: width
source: mprisToastRoot.trackInfo["albumArt"] ?? ""
// Force a 1:1 square target area based on the parent container
width: Math.min(parent.width, parent.height)
} }
} }