1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 21:45:38 -05:00

escape key handling

This commit is contained in:
bbedward
2025-08-05 09:15:27 -04:00
parent ef9e80bfdf
commit fccaf06baa
11 changed files with 191 additions and 19 deletions

View File

@@ -35,7 +35,7 @@ PanelWindow {
implicitHeight: 500
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
WlrLayershell.keyboardFocus: controlCenterVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
color: "transparent"
anchors {
@@ -84,6 +84,27 @@ PanelWindow {
border.width: 1
antialiasing: true
smooth: true
focus: true
Component.onCompleted: {
if (controlCenterVisible)
forceActiveFocus();
}
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Escape) {
controlCenterVisible = false;
event.accepted = true;
}
}
Connections {
function onControlCenterVisibleChanged() {
if (controlCenterVisible)
Qt.callLater(function() {
parent.forceActiveFocus();
});
}
target: root
}
ColumnLayout {
anchors.fill: parent