From 3fb89c437077ea722a145e1b0bda619955808cfb Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Fri, 18 Sep 2026 01:53:56 +0200 Subject: [PATCH] fix(qs): show power menu only on the focused screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A PowerMenu window exists per screen and every one of them lit up on open. Latch the focused monitor in Actions at open time — same shape as launcherScreen — and gate each window's open state on it, so exactly one copy draws and takes keyboard focus. Co-Authored-By: Claude Opus 5 --- quickshell/overlays/PowerMenu.qml | 10 +++++++--- quickshell/services/Actions.qml | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/quickshell/overlays/PowerMenu.qml b/quickshell/overlays/PowerMenu.qml index 955a08b..6c179bd 100644 --- a/quickshell/overlays/PowerMenu.qml +++ b/quickshell/overlays/PowerMenu.qml @@ -13,11 +13,16 @@ PanelWindow { required property var modelData screen: modelData - visible: Actions.powerMenuOpen || closeAnim.running + // Only the screen that had focus when the menu was asked for shows it; the + // other copies stay dormant so the keyboard has one place to land. + readonly property bool open: Actions.powerMenuOpen + && Actions.powerMenuScreen === modelData.name + + visible: root.open || closeAnim.running WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.namespace: "takemi-power" - WlrLayershell.keyboardFocus: Actions.powerMenuOpen + WlrLayershell.keyboardFocus: root.open ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None @@ -25,7 +30,6 @@ PanelWindow { color: "transparent" exclusionMode: ExclusionMode.Ignore - readonly property bool open: Actions.powerMenuOpen property int selectedAction: 0 function focusSelectedAction(): void { diff --git a/quickshell/services/Actions.qml b/quickshell/services/Actions.qml index 20c58be..c69d05a 100644 --- a/quickshell/services/Actions.qml +++ b/quickshell/services/Actions.qml @@ -29,9 +29,16 @@ Singleton { // keyboard focus and because a window should not hop mid-query. property string launcherScreen: "" + // Same story for the power menu: a window per screen, one of them wanted. + property string powerMenuScreen: "" + signal osdRequested(string kind) - function togglePowerMenu() { root.powerMenuOpen = !root.powerMenuOpen; } + function togglePowerMenu() { + if (!root.powerMenuOpen) + root.powerMenuScreen = root.focusedScreenName(); + root.powerMenuOpen = !root.powerMenuOpen; + } function closePowerMenu() { root.powerMenuOpen = false; } function lock() { root.powerMenuOpen = false; root.lockRequested = true; }