From ae332b3f82e84ec8100a48fcce9bca4dc9d6158d Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Thu, 21 Aug 2025 13:38:57 +0200 Subject: [PATCH] Add ESC support for all NPanels --- Widgets/NPanel.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index 9dd2aa4..58b4c61 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -112,6 +112,14 @@ Loader { margins.top: Settings.data.bar.position === "top" ? Style.barHeight * scaling : 0 margins.bottom: Settings.data.bar.position === "bottom" ? Style.barHeight * scaling : 0 + // Close any panel with Esc without requiring focus + Shortcut { + sequences: ["Escape"] + enabled: root.active && !root.isClosing + onActivated: root.close() + context: Shortcut.WindowShortcut + } + // Clicking outside of the rectangle to close MouseArea { anchors.fill: parent @@ -150,6 +158,8 @@ Loader { Component.onCompleted: { root.scaleValue = 1.0 root.opacityValue = 1.0 + // Ensure the panel window becomes the active window so window-scoped shortcuts work (Esc) + Qt.callLater(() => panelWindow.forceActiveFocus()) } // Prevent closing when clicking in the panel bg