allow drawers to close on parent window focus lost

This commit is contained in:
Benjamin Palko 2025-11-10 11:54:25 -05:00
parent 3c3fe368bc
commit 618fc22e80
2 changed files with 42 additions and 2 deletions

View file

@ -1,11 +1,46 @@
import qs.config
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Hyprland
import Quickshell.Widgets
Drawer {
id: control
dim: false
background: Rectangle {
property bool focused: false
onVisibleChanged: {
focused = visible;
}
HyprlandFocusGrab {
active: control.focused
windows: [QsWindow.window]
onCleared: {
control.focused = false;
}
}
background: ClippingWrapperRectangle {
margin: 4
Component.onCompleted: {
if (control.edge == Qt.TopEdge) {
radius = 8;
} else if (control.edge == Qt.LeftEdge) {
topRightRadius = 8;
bottomRightRadius = 8;
} else if (control.edge == Qt.RightEdge) {
topLeftRadius = 8;
bottomLeftRadius = 8;
} else if (control.edge == Qt.BottomEdge) {
topLeftRadius = 8;
topRightRadius = 8;
}
}
color: Styling.theme.base300
Rectangle {
Component.onCompleted: {
if (control.edge == Qt.TopEdge) {
radius = 8;
@ -22,4 +57,5 @@ Drawer {
}
color: Styling.theme.base100
}
}
}

View file

@ -12,6 +12,10 @@ StyledDrawer {
visible: Visibility.dashboard
onFocusedChanged: {
Visibility.dashboard = focused;
}
WrapperItem {
margin: 32
ColumnLayout {