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,46 @@
|
||||||
import qs.config
|
import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Widgets
|
||||||
|
|
||||||
Drawer {
|
Drawer {
|
||||||
id: control
|
id: control
|
||||||
dim: false
|
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: {
|
Component.onCompleted: {
|
||||||
if (control.edge == Qt.TopEdge) {
|
if (control.edge == Qt.TopEdge) {
|
||||||
radius = 8;
|
radius = 8;
|
||||||
|
|
@ -23,3 +58,4 @@ Drawer {
|
||||||
color: Styling.theme.base100
|
color: Styling.theme.base100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ StyledDrawer {
|
||||||
|
|
||||||
visible: Visibility.dashboard
|
visible: Visibility.dashboard
|
||||||
|
|
||||||
|
onFocusedChanged: {
|
||||||
|
Visibility.dashboard = focused;
|
||||||
|
}
|
||||||
|
|
||||||
WrapperItem {
|
WrapperItem {
|
||||||
margin: 32
|
margin: 32
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue