1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-07 22:18:30 -04:00

hyprland: general focus fixes related to #2561

This commit is contained in:
bbedward
2026-06-30 23:27:25 -04:00
parent a1727d18fd
commit 38a03a4485
7 changed files with 26 additions and 3 deletions
@@ -13,6 +13,7 @@ hl.config({
input = { input = {
kb_layout = "us", kb_layout = "us",
numlock_by_default = true, numlock_by_default = true,
follow_mouse = 0,
touchpad = { touchpad = {
tap_to_click = true, tap_to_click = true,
natural_scroll = true, natural_scroll = true,
+10
View File
@@ -25,6 +25,16 @@ Singleton {
return CompositorService.useHyprlandFocusGrab && keyboardFocus(active, customFocus) === WlrKeyboardFocus.OnDemand; return CompositorService.useHyprlandFocusGrab && keyboardFocus(active, customFocus) === WlrKeyboardFocus.OnDemand;
} }
function captureActiveToplevel() {
return ToplevelManager.activeToplevel;
}
function restoreToplevel(toplevel) {
if (toplevel)
Qt.callLater(() => toplevel.activate());
return null;
}
property list<var> barWindows: [] property list<var> barWindows: []
function registerBarWindow(window) { function registerBarWindow(window) {
+3
View File
@@ -58,6 +58,9 @@ Item {
HyprlandFocusGrab { HyprlandFocusGrab {
windows: root.contentWindow ? [root.contentWindow] : [] windows: root.contentWindow ? [root.contentWindow] : []
active: KeyboardFocus.wantsGrab(root.shouldHaveFocus, root.customKeyboardFocus) active: KeyboardFocus.wantsGrab(root.shouldHaveFocus, root.customKeyboardFocus)
property var restoreToplevel: null
onActiveChanged: restoreToplevel = active ? KeyboardFocus.captureActiveToplevel() : KeyboardFocus.restoreToplevel(restoreToplevel)
} }
readonly property var contentWindow: impl.item ? impl.item.contentWindow : null readonly property var contentWindow: impl.item ? impl.item.contentWindow : null
readonly property var effectiveScreen: impl.item ? impl.item.effectiveScreen : null readonly property var effectiveScreen: impl.item ? impl.item.effectiveScreen : null
@@ -1051,6 +1051,9 @@ BasePill {
HyprlandFocusGrab { HyprlandFocusGrab {
windows: [overflowMenu].concat(KeyboardFocus.barWindows) windows: [overflowMenu].concat(KeyboardFocus.barWindows)
active: root.useOverflowPopup && KeyboardFocus.wantsGrab(root.menuOpen, null) active: root.useOverflowPopup && KeyboardFocus.wantsGrab(root.menuOpen, null)
property var restoreToplevel: null
onActiveChanged: restoreToplevel = active ? KeyboardFocus.captureActiveToplevel() : KeyboardFocus.restoreToplevel(restoreToplevel)
} }
Connections { Connections {
@@ -1595,6 +1598,9 @@ BasePill {
HyprlandFocusGrab { HyprlandFocusGrab {
windows: [menuWindow].concat(KeyboardFocus.barWindows) windows: [menuWindow].concat(KeyboardFocus.barWindows)
active: KeyboardFocus.wantsGrab(menuRoot.showMenu, null) active: KeyboardFocus.wantsGrab(menuRoot.showMenu, null)
property var restoreToplevel: null
onActiveChanged: restoreToplevel = active ? KeyboardFocus.captureActiveToplevel() : KeyboardFocus.restoreToplevel(restoreToplevel)
} }
anchors { anchors {
+4 -1
View File
@@ -65,7 +65,10 @@ Item {
list.push(root.backgroundWindow); list.push(root.backgroundWindow);
return list.concat(KeyboardFocus.barWindows); return list.concat(KeyboardFocus.barWindows);
} }
active: KeyboardFocus.wantsGrab(root.shouldBeVisible || root.isClosing, root.customKeyboardFocus) active: KeyboardFocus.wantsGrab(root.shouldBeVisible, root.customKeyboardFocus)
property var restoreToplevel: null
onActiveChanged: restoreToplevel = active ? KeyboardFocus.captureActiveToplevel() : KeyboardFocus.restoreToplevel(restoreToplevel)
} }
Loader { Loader {
+1 -1
View File
@@ -965,7 +965,7 @@ Item {
WlrLayershell.namespace: root.layerNamespace WlrLayershell.namespace: root.layerNamespace
WlrLayershell.layer: root.effectivePopoutLayer WlrLayershell.layer: root.effectivePopoutLayer
WlrLayershell.exclusiveZone: -1 WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: KeyboardFocus.keyboardFocus(shouldBeVisible || (isClosing && CompositorService.useHyprlandFocusGrab), customKeyboardFocus) WlrLayershell.keyboardFocus: KeyboardFocus.keyboardFocus(shouldBeVisible, customKeyboardFocus)
readonly property bool _fullHeight: root.fullHeightSurface readonly property bool _fullHeight: root.fullHeightSurface
anchors { anchors {
+1 -1
View File
@@ -636,7 +636,7 @@ Item {
WlrLayershell.namespace: root.layerNamespace WlrLayershell.namespace: root.layerNamespace
WlrLayershell.layer: root.effectivePopoutLayer WlrLayershell.layer: root.effectivePopoutLayer
WlrLayershell.exclusiveZone: -1 WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: KeyboardFocus.keyboardFocus(shouldBeVisible || (isClosing && CompositorService.useHyprlandFocusGrab), customKeyboardFocus) WlrLayershell.keyboardFocus: KeyboardFocus.keyboardFocus(shouldBeVisible, customKeyboardFocus)
anchors { anchors {
left: true left: true