mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
hypr: add exclusive focus override
This commit is contained in:
@@ -12,7 +12,7 @@ DankModal {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [root.contentWindow]
|
windows: [root.contentWindow]
|
||||||
active: CompositorService.isHyprland && root.shouldHaveFocus
|
active: root.useHyprlandFocusGrab && root.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
property string deviceName: ""
|
property string deviceName: ""
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ DankModal {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [clipboardHistoryModal.contentWindow]
|
windows: [clipboardHistoryModal.contentWindow]
|
||||||
active: CompositorService.isHyprland && clipboardHistoryModal.shouldHaveFocus
|
active: clipboardHistoryModal.useHyprlandFocusGrab && clipboardHistoryModal.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
property int totalCount: 0
|
property int totalCount: 0
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ Item {
|
|||||||
property bool useOverlayLayer: false
|
property bool useOverlayLayer: false
|
||||||
readonly property alias contentWindow: contentWindow
|
readonly property alias contentWindow: contentWindow
|
||||||
readonly property alias backgroundWindow: backgroundWindow
|
readonly property alias backgroundWindow: backgroundWindow
|
||||||
|
readonly property bool useHyprlandFocusGrab: CompositorService.useHyprlandFocusGrab
|
||||||
|
|
||||||
signal opened
|
signal opened
|
||||||
signal dialogClosed
|
signal dialogClosed
|
||||||
@@ -262,7 +263,7 @@ Item {
|
|||||||
return customKeyboardFocus;
|
return customKeyboardFocus;
|
||||||
if (!shouldHaveFocus)
|
if (!shouldHaveFocus)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (CompositorService.isHyprland)
|
if (root.useHyprlandFocusGrab)
|
||||||
return WlrKeyboardFocus.OnDemand;
|
return WlrKeyboardFocus.OnDemand;
|
||||||
return WlrKeyboardFocus.Exclusive;
|
return WlrKeyboardFocus.Exclusive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ DankModal {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [root.contentWindow]
|
windows: [root.contentWindow]
|
||||||
active: CompositorService.isHyprland && root.shouldHaveFocus
|
active: root.useHyprlandFocusGrab && root.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
property string pickerTitle: I18n.tr("Choose Color")
|
property string pickerTitle: I18n.tr("Choose Color")
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ DankModal {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [root.contentWindow]
|
windows: [root.contentWindow]
|
||||||
active: CompositorService.isHyprland && root.shouldHaveFocus
|
active: root.useHyprlandFocusGrab && root.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollDown() {
|
function scrollDown() {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ DankModal {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [notificationModal.contentWindow]
|
windows: [notificationModal.contentWindow]
|
||||||
active: CompositorService.isHyprland && notificationModal.shouldHaveFocus
|
active: notificationModal.useHyprlandFocusGrab && notificationModal.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool notificationModalOpen: false
|
property bool notificationModalOpen: false
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ DankModal {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [root.contentWindow]
|
windows: [root.contentWindow]
|
||||||
active: CompositorService.isHyprland && root.shouldHaveFocus
|
active: root.useHyprlandFocusGrab && root.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
property int selectedIndex: 0
|
property int selectedIndex: 0
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ DankModal {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [spotlightModal.contentWindow]
|
windows: [spotlightModal.contentWindow]
|
||||||
active: CompositorService.isHyprland && spotlightModal.shouldHaveFocus
|
active: spotlightModal.useHyprlandFocusGrab && spotlightModal.shouldHaveFocus
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool spotlightOpen: false
|
property bool spotlightOpen: false
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ DankPopout {
|
|||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (anyModalOpen)
|
if (anyModalOpen)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (CompositorService.isHyprland)
|
if (CompositorService.useHyprlandFocusGrab)
|
||||||
return WlrKeyboardFocus.OnDemand;
|
return WlrKeyboardFocus.OnDemand;
|
||||||
return WlrKeyboardFocus.Exclusive;
|
return WlrKeyboardFocus.Exclusive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ Item {
|
|||||||
WlrLayershell.keyboardFocus: {
|
WlrLayershell.keyboardFocus: {
|
||||||
if (!root.menuOpen)
|
if (!root.menuOpen)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (CompositorService.isHyprland)
|
if (CompositorService.useHyprlandFocusGrab)
|
||||||
return WlrKeyboardFocus.OnDemand;
|
return WlrKeyboardFocus.OnDemand;
|
||||||
return WlrKeyboardFocus.Exclusive;
|
return WlrKeyboardFocus.Exclusive;
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ Item {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [overflowMenu]
|
windows: [overflowMenu]
|
||||||
active: CompositorService.isHyprland && root.menuOpen
|
active: CompositorService.useHyprlandFocusGrab && root.menuOpen
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@@ -915,7 +915,7 @@ Item {
|
|||||||
WlrLayershell.keyboardFocus: {
|
WlrLayershell.keyboardFocus: {
|
||||||
if (!menuRoot.showMenu)
|
if (!menuRoot.showMenu)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (CompositorService.isHyprland)
|
if (CompositorService.useHyprlandFocusGrab)
|
||||||
return WlrKeyboardFocus.OnDemand;
|
return WlrKeyboardFocus.OnDemand;
|
||||||
return WlrKeyboardFocus.Exclusive;
|
return WlrKeyboardFocus.Exclusive;
|
||||||
}
|
}
|
||||||
@@ -923,7 +923,7 @@ Item {
|
|||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
windows: [menuWindow]
|
windows: [menuWindow]
|
||||||
active: CompositorService.isHyprland && menuRoot.showMenu
|
active: CompositorService.useHyprlandFocusGrab && menuRoot.showMenu
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Quickshell
|
|||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
import qs.Common
|
import qs.Common
|
||||||
|
import qs.Services
|
||||||
|
|
||||||
Scope {
|
Scope {
|
||||||
id: overviewScope
|
id: overviewScope
|
||||||
@@ -32,7 +33,13 @@ Scope {
|
|||||||
WlrLayershell.namespace: "dms:workspace-overview"
|
WlrLayershell.namespace: "dms:workspace-overview"
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
WlrLayershell.exclusiveZone: -1
|
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 {
|
anchors {
|
||||||
top: true
|
top: true
|
||||||
@@ -63,7 +70,8 @@ Scope {
|
|||||||
function onOverviewOpenChanged() {
|
function onOverviewOpenChanged() {
|
||||||
if (overviewScope.overviewOpen) {
|
if (overviewScope.overviewOpen) {
|
||||||
grab.hasBeenActivated = false
|
grab.hasBeenActivated = false
|
||||||
delayedGrabTimer.start()
|
if (CompositorService.useHyprlandFocusGrab)
|
||||||
|
delayedGrabTimer.start()
|
||||||
} else {
|
} else {
|
||||||
delayedGrabTimer.stop()
|
delayedGrabTimer.stop()
|
||||||
grab.active = false
|
grab.active = false
|
||||||
@@ -75,6 +83,8 @@ Scope {
|
|||||||
Connections {
|
Connections {
|
||||||
target: root
|
target: root
|
||||||
function onMonitorIsFocusedChanged() {
|
function onMonitorIsFocusedChanged() {
|
||||||
|
if (!CompositorService.useHyprlandFocusGrab)
|
||||||
|
return;
|
||||||
if (overviewScope.overviewOpen && root.monitorIsFocused && !grab.active) {
|
if (overviewScope.overviewOpen && root.monitorIsFocused && !grab.active) {
|
||||||
grab.hasBeenActivated = false
|
grab.hasBeenActivated = false
|
||||||
grab.active = true
|
grab.active = true
|
||||||
@@ -89,7 +99,7 @@ Scope {
|
|||||||
interval: 150
|
interval: 150
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (overviewScope.overviewOpen && root.monitorIsFocused) {
|
if (CompositorService.useHyprlandFocusGrab && overviewScope.overviewOpen && root.monitorIsFocused) {
|
||||||
grab.active = true
|
grab.active = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ Singleton {
|
|||||||
property bool isSway: false
|
property bool isSway: false
|
||||||
property bool isLabwc: false
|
property bool isLabwc: false
|
||||||
property string compositor: "unknown"
|
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 hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
|
||||||
readonly property string niriSocket: Quickshell.env("NIRI_SOCKET")
|
readonly property string niriSocket: Quickshell.env("NIRI_SOCKET")
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ Item {
|
|||||||
return customKeyboardFocus;
|
return customKeyboardFocus;
|
||||||
if (!shouldBeVisible)
|
if (!shouldBeVisible)
|
||||||
return WlrKeyboardFocus.None;
|
return WlrKeyboardFocus.None;
|
||||||
if (CompositorService.isHyprland)
|
if (CompositorService.useHyprlandFocusGrab)
|
||||||
return WlrKeyboardFocus.OnDemand;
|
return WlrKeyboardFocus.OnDemand;
|
||||||
return WlrKeyboardFocus.Exclusive;
|
return WlrKeyboardFocus.Exclusive;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user