fix(qs): show power menu only on the focused screen
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
1cf5a4b68d
commit
3fb89c4370
2 files changed
+15
-4
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user