allow drawers to close on parent window focus lost
This commit is contained in:
parent
3c3fe368bc
commit
618fc22e80
2 changed files with 42 additions and 2 deletions
|
|
@ -1,11 +1,29 @@
|
|||
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;
|
||||
|
|
@ -20,6 +38,24 @@ Drawer {
|
|||
topRightRadius = 8;
|
||||
}
|
||||
}
|
||||
color: Styling.theme.base100
|
||||
color: Styling.theme.base300
|
||||
|
||||
Rectangle {
|
||||
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.base100
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ StyledDrawer {
|
|||
|
||||
visible: Visibility.dashboard
|
||||
|
||||
onFocusedChanged: {
|
||||
Visibility.dashboard = focused;
|
||||
}
|
||||
|
||||
WrapperItem {
|
||||
margin: 32
|
||||
ColumnLayout {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue