1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

fix auto focus app drawer

This commit is contained in:
bbedward
2025-08-20 21:26:09 -04:00
parent bad07df500
commit d20d944d1b

View File

@@ -45,6 +45,14 @@ DankPopout {
WlrLayershell.namespace: "quickshell-launcher" WlrLayershell.namespace: "quickshell-launcher"
screen: triggerScreen screen: triggerScreen
onOpened: {
Qt.callLater(() => {
if (contentLoader.item && contentLoader.item.searchField) {
contentLoader.item.searchField.forceActiveFocus()
}
})
}
AppLauncher { AppLauncher {
id: appLauncher id: appLauncher
@@ -60,6 +68,8 @@ DankPopout {
Rectangle { Rectangle {
id: launcherPanel id: launcherPanel
property alias searchField: searchField
color: Theme.popupBackground() color: Theme.popupBackground()
radius: Theme.cornerRadius radius: Theme.cornerRadius
antialiasing: true antialiasing: true
@@ -100,10 +110,6 @@ DankPopout {
anchors.fill: parent anchors.fill: parent
focus: true focus: true
Component.onCompleted: {
if (appDrawerPopout.shouldBeVisible)
forceActiveFocus()
}
Keys.onPressed: function (event) { Keys.onPressed: function (event) {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {
appDrawerPopout.close() appDrawerPopout.close()
@@ -216,18 +222,10 @@ DankPopout {
event.accepted = false event.accepted = false
} }
} }
Component.onCompleted: {
if (appDrawerPopout.shouldBeVisible)
searchField.forceActiveFocus()
}
Connections { Connections {
function onShouldBeVisibleChanged() { function onShouldBeVisibleChanged() {
if (appDrawerPopout.shouldBeVisible) if (!appDrawerPopout.shouldBeVisible)
Qt.callLater(function () {
searchField.forceActiveFocus()
})
else
searchField.clearFocus() searchField.clearFocus()
} }