1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-02 02:22:06 -04:00

feat(desktop): expose accept keyboard focus to desktop widgets (#2285)

Opt in by setting acceptsKeyboardFocus: true
This commit is contained in:
Kangheng Liu
2026-04-27 10:23:49 -04:00
committed by bbedward
parent 85c2954958
commit 7412fee590

View File

@@ -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,12 +300,15 @@ Item {
}
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.keyboardFocus: {
if (!root.isInteracting)
return WlrKeyboardFocus.None;
if (root.isInteracting) {
if (CompositorService.useHyprlandFocusGrab)
return WlrKeyboardFocus.OnDemand;
return WlrKeyboardFocus.Exclusive;
}
if (root.acceptsKeyboardFocus)
return WlrKeyboardFocus.OnDemand;
return WlrKeyboardFocus.None;
}
HyprlandFocusGrab {
active: CompositorService.isHyprland && root.isInteracting