hefty: bar: click to close popups

This commit is contained in:
end-4
2026-02-21 23:10:57 +01:00
parent 15afa07b14
commit 2bb001a62b
2 changed files with 33 additions and 12 deletions
@@ -4,6 +4,7 @@ import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Hyprland import Quickshell.Hyprland
import qs import qs
import qs.services
import "../../common" import "../../common"
import "../../common/widgets/shapes" as S import "../../common/widgets/shapes" as S
import "../../common/widgets/shapes/material-shapes.js" as MaterialShapes 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 // 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) // ^ (totally not an excuse for my laziness)
if (backgroundShape.progress >= 1.0) { if (backgroundShape.progress >= 1.0) {
root.finishedMorphing = true root.finishedMorphing = true;
} }
} }
} }
@@ -104,18 +105,37 @@ PanelWindow {
root.currentPanel = bar; root.currentPanel = bar;
} }
HBar { Item {
id: bar id: panelRootItem
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 anchors.fill: parent
shown: root.finishedMorphing
}
HOverview { Connections {
id: overview target: GlobalFocusGrab
load: root.currentPanel === this function onActiveChanged() {
shown: root.finishedMorphing if (GlobalFocusGrab.active) {
onRequestFocus: root.currentPanel = overview; panelRootItem.focus = true
onDismissed: root.dismiss(); }
}
}
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 ///////////////// //////////////// Components /////////////////
@@ -12,6 +12,7 @@ import Quickshell.Hyprland
Singleton { Singleton {
id: root id: root
property alias active: grab.active
signal dismissed() signal dismissed()
property list<var> persistent: [] property list<var> persistent: []