diff --git a/modules/Backlight.qml b/modules/Backlight.qml index 6d562b8..626081f 100644 --- a/modules/Backlight.qml +++ b/modules/Backlight.qml @@ -1,5 +1,4 @@ import QtQuick -import Quickshell import Quickshell.Io import "." as M @@ -12,7 +11,7 @@ M.BarSection { property int percent: 0 onPercentChanged: if (percent > 0) - M.OsdState.show(percent / 100, "\uF185", root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0), QsWindow.window?.screen ?? null) + M.OsdState.show(percent / 100, "\uF185") Process { id: adjProc diff --git a/modules/MprisMenu.qml b/modules/MprisMenu.qml index b4bfb29..d1e9f2b 100644 --- a/modules/MprisMenu.qml +++ b/modules/MprisMenu.qml @@ -9,35 +9,23 @@ M.PopupPanel { required property MprisPlayer player - // Album art - Item { + // Album art placeholder (or real art if available) + Rectangle { width: menuWindow.panelWidth - height: _artImg.status === Image.Ready ? 140 : 60 - clip: true - - Rectangle { - anchors.fill: parent - color: M.Theme.base02 - } + height: 80 + color: M.Theme.base02 + radius: M.Theme.radius Image { - id: _artImg anchors.fill: parent source: menuWindow.player?.trackArtUrl ?? "" fillMode: Image.PreserveAspectCrop visible: status === Image.Ready - } - // Gradient fade at the bottom so art blends into the panel - Rectangle { - anchors.left: parent.left - 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 } + // Round top corners to match panel + layer.enabled: true + layer.effect: Item { + // simple clip — the panel background behind handles the rounding } } @@ -48,7 +36,7 @@ M.PopupPanel { color: M.Theme.base04 font.pixelSize: 28 font.family: M.Theme.iconFontFamily - visible: _artImg.status !== Image.Ready + visible: !menuWindow.player?.trackArtUrl } } diff --git a/modules/Osd.qml b/modules/Osd.qml index d3485fb..49ee87d 100644 --- a/modules/Osd.qml +++ b/modules/Osd.qml @@ -13,7 +13,7 @@ PanelWindow { color: "transparent" property bool _winVisible: false - property bool _shown: M.OsdState.visible && M.OsdState.screen === root.screen + property bool _shown: M.OsdState.visible on_ShownChanged: { if (_shown) { @@ -35,10 +35,7 @@ PanelWindow { anchors.left: true margins.top: 0 - margins.left: Math.max(0, Math.min( - Math.round(M.OsdState.itemX - implicitWidth / 2), - screen.width - implicitWidth - )) + margins.left: Math.round((screen.width - implicitWidth) / 2) implicitWidth: 200 implicitHeight: 48 diff --git a/modules/OsdState.qml b/modules/OsdState.qml index a288b07..59c1347 100644 --- a/modules/OsdState.qml +++ b/modules/OsdState.qml @@ -5,19 +5,15 @@ QtObject { property bool visible: false property real value: 0 // 0.0–1.0 property string icon: "" - property real itemX: 0 - property var screen: null property Timer _timer: Timer { interval: 1500 onTriggered: visible = false } - function show(val, ico, x, scr) { + function show(val, ico) { value = val; icon = ico; - itemX = x; - screen = scr; visible = true; _timer.restart(); } diff --git a/modules/Volume.qml b/modules/Volume.qml index 8ac631d..f3eb1ac 100644 --- a/modules/Volume.qml +++ b/modules/Volume.qml @@ -1,5 +1,4 @@ import QtQuick -import Quickshell import Quickshell.Services.Pipewire import "." as M @@ -16,12 +15,8 @@ M.BarSection { readonly property real volume: sink?.audio?.volume ?? 0 readonly property bool muted: sink?.audio?.muted ?? false - function _showOsd() { - const ico = root.muted ? "\uF026" : (volume > 0.5 ? "\uF028" : "\uF027"); - M.OsdState.show(volume, ico, root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0), QsWindow.window?.screen ?? null); - } - onVolumeChanged: _showOsd() - onMutedChanged: _showOsd() + onVolumeChanged: M.OsdState.show(volume, root.muted ? "\uF026" : (volume > 0.5 ? "\uF028" : "\uF027")) + onMutedChanged: M.OsdState.show(volume, root.muted ? "\uF026" : (volume > 0.5 ? "\uF028" : "\uF027")) M.BarIcon { icon: root.muted ? "\uF026" : (root.volume > 0.5 ? "\uF028" : (root.volume > 0 ? "\uF027" : "\uF026"))