mpris menu: proper album art with gradient fade

This commit is contained in:
Damocles 2026-04-12 17:57:45 +02:00
parent 66dc628752
commit a69507980b

View file

@ -9,23 +9,35 @@ M.PopupPanel {
required property MprisPlayer player required property MprisPlayer player
// Album art placeholder (or real art if available) // Album art
Rectangle { Item {
width: menuWindow.panelWidth width: menuWindow.panelWidth
height: 80 height: _artImg.status === Image.Ready ? 140 : 60
clip: true
Rectangle {
anchors.fill: parent
color: M.Theme.base02 color: M.Theme.base02
radius: M.Theme.radius }
Image { Image {
id: _artImg
anchors.fill: parent anchors.fill: parent
source: menuWindow.player?.trackArtUrl ?? "" source: menuWindow.player?.trackArtUrl ?? ""
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
visible: status === Image.Ready visible: status === Image.Ready
}
// Round top corners to match panel // Gradient fade at the bottom so art blends into the panel
layer.enabled: true Rectangle {
layer.effect: Item { anchors.left: parent.left
// simple clip the panel background behind handles the rounding anchors.right: parent.right
anchors.bottom: parent.bottom
height: 40
visible: _artImg.visible
gradient: Gradient {
GradientStop { position: 0; color: "transparent" }
GradientStop { position: 1; color: M.Theme.base01 }
} }
} }
@ -36,7 +48,7 @@ M.PopupPanel {
color: M.Theme.base04 color: M.Theme.base04
font.pixelSize: 28 font.pixelSize: 28
font.family: M.Theme.iconFontFamily font.family: M.Theme.iconFontFamily
visible: !menuWindow.player?.trackArtUrl visible: _artImg.status !== Image.Ready
} }
} }