1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-09 15:08:31 -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 { HyprlandFocusGrab {
id: focusGrab 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 active: root.useHyprlandFocusGrab && root.spotlightOpen
onCleared: { onCleared: {
@@ -228,7 +228,9 @@ Item {
HyprlandFocusGrab { HyprlandFocusGrab {
id: focusGrab 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 active: root.useHyprlandFocusGrab && root.keyboardActive
onCleared: { onCleared: {
if (spotlightOpen) if (spotlightOpen)
@@ -259,7 +259,9 @@ Item {
HyprlandFocusGrab { HyprlandFocusGrab {
id: focusGrab 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 active: root.useHyprlandFocusGrab && root.keyboardActive
onCleared: { onCleared: {
@@ -25,6 +25,7 @@ Item {
property real anchorY: 0 property real anchorY: 0
property bool openState: false property bool openState: false
property bool renderActive: false property bool renderActive: false
readonly property alias contextWindow: menuWindow
readonly property bool blurActive: renderActive && openState && BlurService.enabled && Theme.connectedSurfaceBlurEnabled readonly property bool blurActive: renderActive && openState && BlurService.enabled && Theme.connectedSurfaceBlurEnabled
readonly property real minMenuWidth: 180 readonly property real minMenuWidth: 180
@@ -446,7 +447,17 @@ Item {
WlrLayershell.namespace: "dms:launcher-context-menu" WlrLayershell.namespace: "dms:launcher-context-menu"
WlrLayershell.layer: WlrLayershell.Overlay WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1 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 { anchors {
top: true top: true