fix hover panel positioning: use contentWidth for margins, pass screen from module context

This commit is contained in:
Damocles 2026-04-13 20:56:40 +02:00
parent 0fd3c78fb0
commit ffb869c5cc
4 changed files with 4 additions and 2 deletions

View file

@ -98,6 +98,7 @@ M.BarSection {
M.HoverPanel { M.HoverPanel {
id: hoverPanel id: hoverPanel
showPanel: root._showPanel showPanel: root._showPanel
screen: QsWindow.window?.screen ?? null
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
accentColor: root.accentColor accentColor: root.accentColor
panelNamespace: "nova-backlight" panelNamespace: "nova-backlight"

View file

@ -18,7 +18,6 @@ PanelWindow {
default property alias content: panelContent.children default property alias content: panelContent.children
screen: QsWindow.window?.screen ?? null
visible: _winVisible visible: _winVisible
color: "transparent" color: "transparent"
@ -32,7 +31,7 @@ PanelWindow {
anchors.left: true anchors.left: true
margins.top: 0 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 implicitWidth: panelContent.width
implicitHeight: panelContent.height implicitHeight: panelContent.height

View file

@ -98,6 +98,7 @@ M.BarSection {
M.HoverPanel { M.HoverPanel {
id: hoverPanel id: hoverPanel
showPanel: root._showPanel showPanel: root._showPanel
screen: QsWindow.window?.screen ?? null
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
accentColor: root.accentColor accentColor: root.accentColor
panelNamespace: "nova-mpris" panelNamespace: "nova-mpris"

View file

@ -108,6 +108,7 @@ M.BarSection {
M.HoverPanel { M.HoverPanel {
id: hoverPanel id: hoverPanel
showPanel: root._showPanel showPanel: root._showPanel
screen: QsWindow.window?.screen ?? null
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
accentColor: root.accentColor accentColor: root.accentColor
panelNamespace: "nova-volume" panelNamespace: "nova-volume"