From c9b38023d5386f54077bc9eb3e04c615e2ae4184 Mon Sep 17 00:00:00 2001 From: Kangheng Liu <72962885+kanghengliu@users.noreply.github.com> Date: Mon, 27 Apr 2026 10:23:49 -0400 Subject: [PATCH] feat(desktop): expose accept keyboard focus to desktop widgets (#2285) Opt in by setting acceptsKeyboardFocus: true --- quickshell/Modules/Plugins/DesktopPluginWrapper.qml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quickshell/Modules/Plugins/DesktopPluginWrapper.qml b/quickshell/Modules/Plugins/DesktopPluginWrapper.qml index c7a5c766..c9f05249 100644 --- a/quickshell/Modules/Plugins/DesktopPluginWrapper.qml +++ b/quickshell/Modules/Plugins/DesktopPluginWrapper.qml @@ -211,6 +211,7 @@ Item { property real minWidth: contentLoader.item?.minWidth ?? 100 property real minHeight: contentLoader.item?.minHeight ?? 100 property bool forceSquare: contentLoader.item?.forceSquare ?? false + property bool acceptsKeyboardFocus: contentLoader.item?.acceptsKeyboardFocus ?? false property bool isInteracting: dragArea.pressed || resizeArea.pressed property var _gridSettingsTrigger: SettingsData.desktopWidgetGridSettings @@ -299,11 +300,14 @@ Item { } WlrLayershell.exclusionMode: ExclusionMode.Ignore WlrLayershell.keyboardFocus: { - if (!root.isInteracting) - return WlrKeyboardFocus.None; - if (CompositorService.useHyprlandFocusGrab) + if (root.isInteracting) { + if (CompositorService.useHyprlandFocusGrab) + return WlrKeyboardFocus.OnDemand; + return WlrKeyboardFocus.Exclusive; + } + if (root.acceptsKeyboardFocus) return WlrKeyboardFocus.OnDemand; - return WlrKeyboardFocus.Exclusive; + return WlrKeyboardFocus.None; } HyprlandFocusGrab {