1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-01 19:18:28 -04:00

launcher: fix hyprland focus on context menu

fixes #2714
This commit is contained in:
bbedward
2026-06-30 10:04:44 -04:00
parent 9d550d7c11
commit 161118122e
4 changed files with 21 additions and 4 deletions
@@ -530,7 +530,9 @@ Item {
HyprlandFocusGrab {
id: focusGrab
windows: [contentWindow]
readonly property var contextMenuWindow: root.spotlightContent?.activeContextMenu?.contextWindow ?? null
readonly property bool contextMenuActive: root.spotlightContent?.activeContextMenu?.renderActive ?? false
windows: contextMenuActive && contextMenuWindow ? [contentWindow, contextMenuWindow] : [contentWindow]
active: root.useHyprlandFocusGrab && root.spotlightOpen
onCleared: {
@@ -228,7 +228,9 @@ Item {
HyprlandFocusGrab {
id: focusGrab
windows: [launcherWindow]
readonly property var contextMenuWindow: root.spotlightContent?.activeContextMenu?.contextWindow ?? null
readonly property bool contextMenuActive: root.spotlightContent?.activeContextMenu?.renderActive ?? false
windows: contextMenuActive && contextMenuWindow ? [launcherWindow, contextMenuWindow] : [launcherWindow]
active: root.useHyprlandFocusGrab && root.keyboardActive
onCleared: {
if (spotlightOpen)
@@ -259,7 +259,9 @@ Item {
HyprlandFocusGrab {
id: focusGrab
windows: [launcherWindow]
readonly property var contextMenuWindow: root.spotlightContent?.activeContextMenu?.contextWindow ?? null
readonly property bool contextMenuActive: root.spotlightContent?.activeContextMenu?.renderActive ?? false
windows: contextMenuActive && contextMenuWindow ? [launcherWindow, contextMenuWindow] : [launcherWindow]
active: root.useHyprlandFocusGrab && root.keyboardActive
onCleared: {
@@ -25,6 +25,7 @@ Item {
property real anchorY: 0
property bool openState: false
property bool renderActive: false
readonly property alias contextWindow: menuWindow
readonly property bool blurActive: renderActive && openState && BlurService.enabled && Theme.connectedSurfaceBlurEnabled
readonly property real minMenuWidth: 180
@@ -446,7 +447,17 @@ Item {
WlrLayershell.namespace: "dms:launcher-context-menu"
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: PopoutManager.screenshotActive ? WlrKeyboardFocus.None : (root.renderActive ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None)
// Hyprland steals the launcher's focus grab on exclusive focus; keep keys on the
// launcher window, which forwards them to the menu via handleKey().
WlrLayershell.keyboardFocus: {
if (PopoutManager.screenshotActive)
return WlrKeyboardFocus.None;
if (!root.renderActive)
return WlrKeyboardFocus.None;
if (CompositorService.useHyprlandFocusGrab)
return WlrKeyboardFocus.None;
return WlrKeyboardFocus.Exclusive;
}
anchors {
top: true