From 455252dff187865061812a2c09d93ad102944f4a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 21 Feb 2026 23:10:57 +0100 Subject: [PATCH] hefty: bar: click to close popups --- .../modules/hefty/topLayer/HTopLayerPanel.qml | 44 ++++++++++++++----- .../ii/services/GlobalFocusGrab.qml | 1 + 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml b/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml index ab2981707..bd7da8d83 100644 --- a/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml +++ b/dots/.config/quickshell/ii/modules/hefty/topLayer/HTopLayerPanel.qml @@ -4,6 +4,7 @@ import Quickshell import Quickshell.Wayland import Quickshell.Hyprland import qs +import qs.services import "../../common" import "../../common/widgets/shapes" as S import "../../common/widgets/shapes/material-shapes.js" as MaterialShapes @@ -43,7 +44,7 @@ PanelWindow { // While it overshoots because of the spring animation, waiting for the bounce to finish entirely would be too slow // ^ (totally not an excuse for my laziness) if (backgroundShape.progress >= 1.0) { - root.finishedMorphing = true + root.finishedMorphing = true; } } } @@ -104,18 +105,37 @@ PanelWindow { root.currentPanel = bar; } - HBar { - id: bar - load: root.currentPanel === this && root.finishedMorphing // the extra condition is to prevent workspace widget from acting up when switching horizontal/vertical... should be fixed later - shown: root.finishedMorphing - } + Item { + id: panelRootItem + anchors.fill: parent - HOverview { - id: overview - load: root.currentPanel === this - shown: root.finishedMorphing - onRequestFocus: root.currentPanel = overview; - onDismissed: root.dismiss(); + Connections { + target: GlobalFocusGrab + function onActiveChanged() { + if (GlobalFocusGrab.active) { + panelRootItem.focus = true + } + } + } + Keys.onPressed: (event) => { // Esc to close + if (event.key === Qt.Key_Escape) { + GlobalFocusGrab.dismiss(); + } + } + + HBar { + id: bar + load: root.currentPanel === this && root.finishedMorphing // the extra condition is to prevent workspace widget from acting up when switching horizontal/vertical... should be fixed later + shown: root.finishedMorphing + } + + HOverview { + id: overview + load: root.currentPanel === this + shown: root.finishedMorphing + onRequestFocus: root.currentPanel = overview + onDismissed: root.dismiss() + } } //////////////// Components ///////////////// diff --git a/dots/.config/quickshell/ii/services/GlobalFocusGrab.qml b/dots/.config/quickshell/ii/services/GlobalFocusGrab.qml index 6385d3df7..4867a5bc0 100644 --- a/dots/.config/quickshell/ii/services/GlobalFocusGrab.qml +++ b/dots/.config/quickshell/ii/services/GlobalFocusGrab.qml @@ -12,6 +12,7 @@ import Quickshell.Hyprland Singleton { id: root + property alias active: grab.active signal dismissed() property list persistent: []