diff --git a/quickshell/Modals/BluetoothPairingModal.qml b/quickshell/Modals/BluetoothPairingModal.qml index dab5310d..cd3c9b7e 100644 --- a/quickshell/Modals/BluetoothPairingModal.qml +++ b/quickshell/Modals/BluetoothPairingModal.qml @@ -12,7 +12,7 @@ DankModal { HyprlandFocusGrab { windows: [root.contentWindow] - active: CompositorService.isHyprland && root.shouldHaveFocus + active: root.useHyprlandFocusGrab && root.shouldHaveFocus } property string deviceName: "" diff --git a/quickshell/Modals/Clipboard/ClipboardHistoryModal.qml b/quickshell/Modals/Clipboard/ClipboardHistoryModal.qml index 74a773bc..73fb07a5 100644 --- a/quickshell/Modals/Clipboard/ClipboardHistoryModal.qml +++ b/quickshell/Modals/Clipboard/ClipboardHistoryModal.qml @@ -15,7 +15,7 @@ DankModal { HyprlandFocusGrab { windows: [clipboardHistoryModal.contentWindow] - active: CompositorService.isHyprland && clipboardHistoryModal.shouldHaveFocus + active: clipboardHistoryModal.useHyprlandFocusGrab && clipboardHistoryModal.shouldHaveFocus } property int totalCount: 0 diff --git a/quickshell/Modals/Common/DankModal.qml b/quickshell/Modals/Common/DankModal.qml index 8a5239ad..183dd958 100644 --- a/quickshell/Modals/Common/DankModal.qml +++ b/quickshell/Modals/Common/DankModal.qml @@ -47,6 +47,7 @@ Item { property bool useOverlayLayer: false readonly property alias contentWindow: contentWindow readonly property alias backgroundWindow: backgroundWindow + readonly property bool useHyprlandFocusGrab: CompositorService.useHyprlandFocusGrab signal opened signal dialogClosed @@ -262,7 +263,7 @@ Item { return customKeyboardFocus; if (!shouldHaveFocus) return WlrKeyboardFocus.None; - if (CompositorService.isHyprland) + if (root.useHyprlandFocusGrab) return WlrKeyboardFocus.OnDemand; return WlrKeyboardFocus.Exclusive; } diff --git a/quickshell/Modals/DankColorPickerModal.qml b/quickshell/Modals/DankColorPickerModal.qml index 2ef1879a..c7f57739 100644 --- a/quickshell/Modals/DankColorPickerModal.qml +++ b/quickshell/Modals/DankColorPickerModal.qml @@ -13,7 +13,7 @@ DankModal { HyprlandFocusGrab { windows: [root.contentWindow] - active: CompositorService.isHyprland && root.shouldHaveFocus + active: root.useHyprlandFocusGrab && root.shouldHaveFocus } property string pickerTitle: I18n.tr("Choose Color") diff --git a/quickshell/Modals/KeybindsModal.qml b/quickshell/Modals/KeybindsModal.qml index 3ca4ae7e..7132e74f 100644 --- a/quickshell/Modals/KeybindsModal.qml +++ b/quickshell/Modals/KeybindsModal.qml @@ -21,7 +21,7 @@ DankModal { HyprlandFocusGrab { windows: [root.contentWindow] - active: CompositorService.isHyprland && root.shouldHaveFocus + active: root.useHyprlandFocusGrab && root.shouldHaveFocus } function scrollDown() { diff --git a/quickshell/Modals/NotificationModal.qml b/quickshell/Modals/NotificationModal.qml index 1d0b51a2..63fc87e8 100644 --- a/quickshell/Modals/NotificationModal.qml +++ b/quickshell/Modals/NotificationModal.qml @@ -13,7 +13,7 @@ DankModal { HyprlandFocusGrab { windows: [notificationModal.contentWindow] - active: CompositorService.isHyprland && notificationModal.shouldHaveFocus + active: notificationModal.useHyprlandFocusGrab && notificationModal.shouldHaveFocus } property bool notificationModalOpen: false diff --git a/quickshell/Modals/PowerMenuModal.qml b/quickshell/Modals/PowerMenuModal.qml index d92dabc5..40802319 100644 --- a/quickshell/Modals/PowerMenuModal.qml +++ b/quickshell/Modals/PowerMenuModal.qml @@ -15,7 +15,7 @@ DankModal { HyprlandFocusGrab { windows: [root.contentWindow] - active: CompositorService.isHyprland && root.shouldHaveFocus + active: root.useHyprlandFocusGrab && root.shouldHaveFocus } property int selectedIndex: 0 diff --git a/quickshell/Modals/Spotlight/SpotlightModal.qml b/quickshell/Modals/Spotlight/SpotlightModal.qml index 5cb066c3..9fef779b 100644 --- a/quickshell/Modals/Spotlight/SpotlightModal.qml +++ b/quickshell/Modals/Spotlight/SpotlightModal.qml @@ -12,7 +12,7 @@ DankModal { HyprlandFocusGrab { windows: [spotlightModal.contentWindow] - active: CompositorService.isHyprland && spotlightModal.shouldHaveFocus + active: spotlightModal.useHyprlandFocusGrab && spotlightModal.shouldHaveFocus } property bool spotlightOpen: false diff --git a/quickshell/Modules/ControlCenter/ControlCenterPopout.qml b/quickshell/Modules/ControlCenter/ControlCenterPopout.qml index ff240c62..62773f8a 100644 --- a/quickshell/Modules/ControlCenter/ControlCenterPopout.qml +++ b/quickshell/Modules/ControlCenter/ControlCenterPopout.qml @@ -76,7 +76,7 @@ DankPopout { return WlrKeyboardFocus.None; if (anyModalOpen) return WlrKeyboardFocus.None; - if (CompositorService.isHyprland) + if (CompositorService.useHyprlandFocusGrab) return WlrKeyboardFocus.OnDemand; return WlrKeyboardFocus.Exclusive; } diff --git a/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml b/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml index 0ae7dba1..f35eb7dc 100644 --- a/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml +++ b/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml @@ -427,7 +427,7 @@ Item { WlrLayershell.keyboardFocus: { if (!root.menuOpen) return WlrKeyboardFocus.None; - if (CompositorService.isHyprland) + if (CompositorService.useHyprlandFocusGrab) return WlrKeyboardFocus.OnDemand; return WlrKeyboardFocus.Exclusive; } @@ -436,7 +436,7 @@ Item { HyprlandFocusGrab { windows: [overflowMenu] - active: CompositorService.isHyprland && root.menuOpen + active: CompositorService.useHyprlandFocusGrab && root.menuOpen } Connections { @@ -915,7 +915,7 @@ Item { WlrLayershell.keyboardFocus: { if (!menuRoot.showMenu) return WlrKeyboardFocus.None; - if (CompositorService.isHyprland) + if (CompositorService.useHyprlandFocusGrab) return WlrKeyboardFocus.OnDemand; return WlrKeyboardFocus.Exclusive; } @@ -923,7 +923,7 @@ Item { HyprlandFocusGrab { windows: [menuWindow] - active: CompositorService.isHyprland && menuRoot.showMenu + active: CompositorService.useHyprlandFocusGrab && menuRoot.showMenu } anchors { diff --git a/quickshell/Modules/WorkspaceOverlays/HyprlandOverview.qml b/quickshell/Modules/WorkspaceOverlays/HyprlandOverview.qml index dc3a5730..19330352 100644 --- a/quickshell/Modules/WorkspaceOverlays/HyprlandOverview.qml +++ b/quickshell/Modules/WorkspaceOverlays/HyprlandOverview.qml @@ -4,6 +4,7 @@ import Quickshell import Quickshell.Wayland import Quickshell.Hyprland import qs.Common +import qs.Services Scope { id: overviewScope @@ -32,7 +33,13 @@ Scope { WlrLayershell.namespace: "dms:workspace-overview" WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.exclusiveZone: -1 - WlrLayershell.keyboardFocus: overviewScope.overviewOpen ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None + WlrLayershell.keyboardFocus: { + if (!overviewScope.overviewOpen) + return WlrKeyboardFocus.None; + if (CompositorService.useHyprlandFocusGrab) + return WlrKeyboardFocus.OnDemand; + return WlrKeyboardFocus.Exclusive; + } anchors { top: true @@ -63,7 +70,8 @@ Scope { function onOverviewOpenChanged() { if (overviewScope.overviewOpen) { grab.hasBeenActivated = false - delayedGrabTimer.start() + if (CompositorService.useHyprlandFocusGrab) + delayedGrabTimer.start() } else { delayedGrabTimer.stop() grab.active = false @@ -75,6 +83,8 @@ Scope { Connections { target: root function onMonitorIsFocusedChanged() { + if (!CompositorService.useHyprlandFocusGrab) + return; if (overviewScope.overviewOpen && root.monitorIsFocused && !grab.active) { grab.hasBeenActivated = false grab.active = true @@ -89,7 +99,7 @@ Scope { interval: 150 repeat: false onTriggered: { - if (overviewScope.overviewOpen && root.monitorIsFocused) { + if (CompositorService.useHyprlandFocusGrab && overviewScope.overviewOpen && root.monitorIsFocused) { grab.active = true } } diff --git a/quickshell/Services/CompositorService.qml b/quickshell/Services/CompositorService.qml index f1536f67..29335bc3 100644 --- a/quickshell/Services/CompositorService.qml +++ b/quickshell/Services/CompositorService.qml @@ -16,6 +16,7 @@ Singleton { property bool isSway: false property bool isLabwc: false property string compositor: "unknown" + readonly property bool useHyprlandFocusGrab: isHyprland && Quickshell.env("DMS_HYPRLAND_EXCLUSIVE_FOCUS") !== "1" readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE") readonly property string niriSocket: Quickshell.env("NIRI_SOCKET") diff --git a/quickshell/Widgets/DankPopout.qml b/quickshell/Widgets/DankPopout.qml index 576f0034..7835bc3e 100644 --- a/quickshell/Widgets/DankPopout.qml +++ b/quickshell/Widgets/DankPopout.qml @@ -286,7 +286,7 @@ Item { return customKeyboardFocus; if (!shouldBeVisible) return WlrKeyboardFocus.None; - if (CompositorService.isHyprland) + if (CompositorService.useHyprlandFocusGrab) return WlrKeyboardFocus.OnDemand; return WlrKeyboardFocus.Exclusive; }