From c59a2c622d0f95ab8dbf156498aaa80a9b7c8cde Mon Sep 17 00:00:00 2001 From: Damocles Date: Sun, 12 Apr 2026 15:36:11 +0200 Subject: [PATCH] fix flyouts on multiple monitors again? --- modules/BarIcon.qml | 2 +- modules/BarLabel.qml | 2 +- modules/BarSection.qml | 2 +- modules/PowerProfile.qml | 4 +++- modules/Tray.qml | 4 ++-- modules/Wlogout.qml | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/BarIcon.qml b/modules/BarIcon.qml index 371dd6a..e0033a9 100644 --- a/modules/BarIcon.qml +++ b/modules/BarIcon.qml @@ -17,7 +17,7 @@ Text { onHoveredChanged: { if (hovered && root.tooltip !== "") { M.FlyoutState.text = root.tooltip; - M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x; + M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); M.FlyoutState.screen = QsWindow.window?.screen ?? null; M.FlyoutState.visible = true; } else if (!hovered && root.tooltip !== "") { diff --git a/modules/BarLabel.qml b/modules/BarLabel.qml index cdf416f..f5cff64 100644 --- a/modules/BarLabel.qml +++ b/modules/BarLabel.qml @@ -17,7 +17,7 @@ Text { onHoveredChanged: { if (hovered && root.tooltip !== "") { M.FlyoutState.text = root.tooltip; - M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x; + M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); M.FlyoutState.screen = QsWindow.window?.screen ?? null; M.FlyoutState.visible = true; } else if (!hovered && root.tooltip !== "") { diff --git a/modules/BarSection.qml b/modules/BarSection.qml index f248b80..0602fb4 100644 --- a/modules/BarSection.qml +++ b/modules/BarSection.qml @@ -10,7 +10,7 @@ Row { onHoveredChanged: { if (hovered && root.tooltip !== "") { M.FlyoutState.text = root.tooltip; - M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x; + M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); M.FlyoutState.screen = QsWindow.window?.screen ?? null; M.FlyoutState.visible = true; } else if (!hovered && root.tooltip !== "") { diff --git a/modules/PowerProfile.qml b/modules/PowerProfile.qml index 904492f..236437a 100644 --- a/modules/PowerProfile.qml +++ b/modules/PowerProfile.qml @@ -51,7 +51,9 @@ M.BarIcon { onClicked: { const cycle = ["performance", "balanced", "power-saver"]; const idx = cycle.indexOf(root.profile); - setter.next = cycle[(idx + 1) % cycle.length]; + const next = cycle[(idx + 1) % cycle.length]; + root.profile = next; + setter.next = next; setter.running = true; } } diff --git a/modules/Tray.qml b/modules/Tray.qml index abe87f2..2474a3f 100644 --- a/modules/Tray.qml +++ b/modules/Tray.qml @@ -34,7 +34,7 @@ RowLayout { .filter(s => s).join("\n") || iconItem.modelData.title; if (hovered && tip) { M.FlyoutState.text = tip; - M.FlyoutState.itemX = iconItem.mapToGlobal(iconItem.width / 2, 0).x; + M.FlyoutState.itemX = iconItem.mapToGlobal(iconItem.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); M.FlyoutState.screen = QsWindow.window?.screen ?? null; M.FlyoutState.visible = true; } else if (!hovered) { @@ -69,7 +69,7 @@ RowLayout { sourceComponent: M.TrayMenu { handle: iconItem.modelData.menu screen: root.bar.screen - anchorX: iconItem.mapToGlobal(iconItem.width / 2, 0).x + anchorX: iconItem.mapToGlobal(iconItem.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) onMenuClosed: { menuLoader.active = false; root._activeMenu = null; diff --git a/modules/Wlogout.qml b/modules/Wlogout.qml index 640b024..2f4e9ed 100644 --- a/modules/Wlogout.qml +++ b/modules/Wlogout.qml @@ -20,7 +20,7 @@ M.BarIcon { active: false sourceComponent: M.PowerMenu { screen: root.bar.screen - anchorX: root.mapToGlobal(root.width / 2, 0).x + anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) onMenuClosed: menuLoader.active = false } }