From fc69ca059917bdaee8b934fcc5ca4891c33f037a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 27 Aug 2025 20:13:46 +0700 Subject: [PATCH] sidebar: wifi dialog: esc to close --- .../quickshell/ii/modules/common/widgets/WindowDialog.qml | 7 +++++++ .../ii/modules/sidebarRight/SidebarRightContent.qml | 7 ++++++- .../ii/modules/sidebarRight/wifiNetworks/WifiDialog.qml | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/ii/modules/common/widgets/WindowDialog.qml b/.config/quickshell/ii/modules/common/widgets/WindowDialog.qml index 084f0bbed..d4f9f3285 100644 --- a/.config/quickshell/ii/modules/common/widgets/WindowDialog.qml +++ b/.config/quickshell/ii/modules/common/widgets/WindowDialog.qml @@ -12,7 +12,14 @@ Rectangle { default property alias data: contentColumn.data property real backgroundHeight: 600 property real backgroundAnimationMovementDistance: 60 + signal dismiss() + Keys.onPressed: (event) => { + if (event.key === Qt.Key_Escape) { + root.dismiss(); + event.accepted = true; + } + } color: root.show ? Appearance.colors.colScrim : ColorUtils.transparentize(Appearance.colors.colScrim) Behavior on color { diff --git a/.config/quickshell/ii/modules/sidebarRight/SidebarRightContent.qml b/.config/quickshell/ii/modules/sidebarRight/SidebarRightContent.qml index f02a2b8a1..37878a669 100644 --- a/.config/quickshell/ii/modules/sidebarRight/SidebarRightContent.qml +++ b/.config/quickshell/ii/modules/sidebarRight/SidebarRightContent.qml @@ -159,7 +159,12 @@ Item { anchors.fill: parent active: root.showWifiDialog || item.visible - onActiveChanged: if (active) item.show = true + onActiveChanged: { + if (active) { + item.show = true; + item.forceActiveFocus(); + } + } sourceComponent: WifiDialog { onDismiss: { diff --git a/.config/quickshell/ii/modules/sidebarRight/wifiNetworks/WifiDialog.qml b/.config/quickshell/ii/modules/sidebarRight/wifiNetworks/WifiDialog.qml index d7e9dd723..6569704a8 100644 --- a/.config/quickshell/ii/modules/sidebarRight/wifiNetworks/WifiDialog.qml +++ b/.config/quickshell/ii/modules/sidebarRight/wifiNetworks/WifiDialog.qml @@ -17,7 +17,7 @@ import Quickshell.Hyprland WindowDialog { id: root - + WindowDialogTitle { text: Translation.tr("Connect to Wi-Fi") }