From a168b12bb20223d362b7463cbff9cbda8645e72d Mon Sep 17 00:00:00 2001 From: purian23 Date: Mon, 9 Feb 2026 19:42:27 -0500 Subject: [PATCH] dankbar: Fix widget context focus w/Autohide enabled --- .../DankBar/Widgets/AppsDockContextMenu.qml | 21 +++++++++++++++++++ .../DankBar/Widgets/ClipboardButton.qml | 21 +++++++++++++++++++ .../Modules/DankBar/Widgets/NotepadButton.qml | 21 +++++++++++++++++++ .../Modules/DankBar/Widgets/RunningApps.qml | 21 +++++++++++++++++++ 4 files changed, 84 insertions(+) diff --git a/quickshell/Modules/DankBar/Widgets/AppsDockContextMenu.qml b/quickshell/Modules/DankBar/Widgets/AppsDockContextMenu.qml index 48ed1422..e9013ada 100644 --- a/quickshell/Modules/DankBar/Widgets/AppsDockContextMenu.qml +++ b/quickshell/Modules/DankBar/Widgets/AppsDockContextMenu.qml @@ -37,10 +37,18 @@ PanelWindow { desktopEntry = entry || null; visible = true; + + if (targetScreen) { + TrayMenuManager.registerMenu(targetScreen.name, root); + } } function close() { visible = false; + + if (root.screen) { + TrayMenuManager.unregisterMenu(root.screen.name); + } } screen: null @@ -56,6 +64,19 @@ PanelWindow { bottom: true } + Component.onDestruction: { + if (root.screen) { + TrayMenuManager.unregisterMenu(root.screen.name); + } + } + + Connections { + target: PopoutManager + function onPopoutOpening() { + root.close(); + } + } + Rectangle { id: menuContainer diff --git a/quickshell/Modules/DankBar/Widgets/ClipboardButton.qml b/quickshell/Modules/DankBar/Widgets/ClipboardButton.qml index 0da3f4b2..4a3e96b0 100644 --- a/quickshell/Modules/DankBar/Widgets/ClipboardButton.qml +++ b/quickshell/Modules/DankBar/Widgets/ClipboardButton.qml @@ -111,10 +111,18 @@ BasePill { edge = barEdge ?? "top"; visible = true; + + if (contextMenuWindow.screen) { + TrayMenuManager.registerMenu(contextMenuWindow.screen.name, contextMenuWindow); + } } function closeMenu() { visible = false; + + if (contextMenuWindow.screen) { + TrayMenuManager.unregisterMenu(contextMenuWindow.screen.name); + } } screen: null @@ -130,6 +138,19 @@ BasePill { bottom: true } + Component.onDestruction: { + if (contextMenuWindow.screen) { + TrayMenuManager.unregisterMenu(contextMenuWindow.screen.name); + } + } + + Connections { + target: PopoutManager + function onPopoutOpening() { + contextMenuWindow.closeMenu(); + } + } + MouseArea { anchors.fill: parent acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton diff --git a/quickshell/Modules/DankBar/Widgets/NotepadButton.qml b/quickshell/Modules/DankBar/Widgets/NotepadButton.qml index 06eb961b..5dd68194 100644 --- a/quickshell/Modules/DankBar/Widgets/NotepadButton.qml +++ b/quickshell/Modules/DankBar/Widgets/NotepadButton.qml @@ -161,10 +161,18 @@ BasePill { edge = barEdge ?? "top"; visible = true; + + if (contextMenuWindow.screen) { + TrayMenuManager.registerMenu(contextMenuWindow.screen.name, contextMenuWindow); + } } function closeMenu() { visible = false; + + if (contextMenuWindow.screen) { + TrayMenuManager.unregisterMenu(contextMenuWindow.screen.name); + } } screen: null @@ -180,6 +188,19 @@ BasePill { bottom: true } + Component.onDestruction: { + if (contextMenuWindow.screen) { + TrayMenuManager.unregisterMenu(contextMenuWindow.screen.name); + } + } + + Connections { + target: PopoutManager + function onPopoutOpening() { + contextMenuWindow.closeMenu(); + } + } + MouseArea { anchors.fill: parent z: 0 diff --git a/quickshell/Modules/DankBar/Widgets/RunningApps.qml b/quickshell/Modules/DankBar/Widgets/RunningApps.qml index de320cd9..c3297f4b 100644 --- a/quickshell/Modules/DankBar/Widgets/RunningApps.qml +++ b/quickshell/Modules/DankBar/Widgets/RunningApps.qml @@ -855,12 +855,20 @@ Item { edge = barEdge ?? "top"; isVisible = true; visible = true; + + if (screen) { + TrayMenuManager.registerMenu(screen.name, contextMenuWindow); + } } function close() { isVisible = false; visible = false; windowContextMenuLoader.active = false; + + if (screen) { + TrayMenuManager.unregisterMenu(screen.name); + } } implicitWidth: 100 @@ -879,6 +887,19 @@ Item { bottom: true } + Component.onDestruction: { + if (screen) { + TrayMenuManager.unregisterMenu(screen.name); + } + } + + Connections { + target: PopoutManager + function onPopoutOpening() { + contextMenuWindow.close(); + } + } + MouseArea { anchors.fill: parent onClicked: contextMenuWindow.close()