From ffb869c5ccad159477c986bdaac062a0ca247f5b Mon Sep 17 00:00:00 2001 From: Damocles Date: Mon, 13 Apr 2026 20:56:40 +0200 Subject: [PATCH] fix hover panel positioning: use contentWidth for margins, pass screen from module context --- modules/Backlight.qml | 1 + modules/HoverPanel.qml | 3 +-- modules/Mpris.qml | 1 + modules/Volume.qml | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/Backlight.qml b/modules/Backlight.qml index f98a862..396ee85 100644 --- a/modules/Backlight.qml +++ b/modules/Backlight.qml @@ -98,6 +98,7 @@ M.BarSection { M.HoverPanel { id: hoverPanel showPanel: root._showPanel + screen: QsWindow.window?.screen ?? null anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) accentColor: root.accentColor panelNamespace: "nova-backlight" diff --git a/modules/HoverPanel.qml b/modules/HoverPanel.qml index f7cb7a2..3ac7640 100644 --- a/modules/HoverPanel.qml +++ b/modules/HoverPanel.qml @@ -18,7 +18,6 @@ PanelWindow { default property alias content: panelContent.children - screen: QsWindow.window?.screen ?? null visible: _winVisible color: "transparent" @@ -32,7 +31,7 @@ PanelWindow { anchors.left: true margins.top: 0 - margins.left: Math.max(0, Math.min(Math.round(anchorX - implicitWidth / 2), (screen?.width ?? 1920) - implicitWidth)) + margins.left: Math.max(0, Math.min(Math.round(anchorX - contentWidth / 2), (screen?.width ?? 1920) - contentWidth)) implicitWidth: panelContent.width implicitHeight: panelContent.height diff --git a/modules/Mpris.qml b/modules/Mpris.qml index fe15f2c..4cf8907 100644 --- a/modules/Mpris.qml +++ b/modules/Mpris.qml @@ -98,6 +98,7 @@ M.BarSection { M.HoverPanel { id: hoverPanel showPanel: root._showPanel + screen: QsWindow.window?.screen ?? null anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) accentColor: root.accentColor panelNamespace: "nova-mpris" diff --git a/modules/Volume.qml b/modules/Volume.qml index 8f8bea5..982a8a6 100644 --- a/modules/Volume.qml +++ b/modules/Volume.qml @@ -108,6 +108,7 @@ M.BarSection { M.HoverPanel { id: hoverPanel showPanel: root._showPanel + screen: QsWindow.window?.screen ?? null anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) accentColor: root.accentColor panelNamespace: "nova-volume"