Skip to content

Commit e12b9ee

Browse files
committed
internal: centralise focus grabs
Except detached popouts focus grab (its meant to be exclusive to the other grab)
1 parent b1086c9 commit e12b9ee

4 files changed

Lines changed: 6 additions & 18 deletions

File tree

modules/bar/popouts/TrayMenu.qml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import qs.services
55
import qs.config
66
import Quickshell
77
import Quickshell.Widgets
8-
import Quickshell.Hyprland
98
import QtQuick
109
import QtQuick.Controls
1110

@@ -27,12 +26,6 @@ StackView {
2726
popEnter: NoAnim {}
2827
popExit: NoAnim {}
2928

30-
HyprlandFocusGrab {
31-
active: root.depth > 1
32-
windows: [QsWindow.window]
33-
onCleared: root.popouts.hasCurrent = false
34-
}
35-
3629
component NoAnim: Transition {
3730
NumberAnimation {
3831
duration: 0

modules/dashboard/Wrapper.qml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import qs.config
66
import qs.utils
77
import Caelestia
88
import Quickshell
9-
import Quickshell.Hyprland
109
import QtQuick
1110

1211
Item {
@@ -77,12 +76,6 @@ Item {
7776
}
7877
]
7978

80-
HyprlandFocusGrab {
81-
active: !Config.dashboard.showOnHover && root.visibilities.dashboard && Config.dashboard.enabled
82-
windows: [QsWindow.window]
83-
onCleared: root.visibilities.dashboard = false
84-
}
85-
8679
Timer {
8780
id: timer
8881

modules/drawers/Drawers.qml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Variants {
4040
WlrLayershell.exclusionMode: ExclusionMode.Ignore
4141
WlrLayershell.keyboardFocus: visibilities.launcher || visibilities.session ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
4242

43-
mask: focusGrab.active || Hypr.focusedMonitor?.activeWorkspace?.lastIpcObject.windows > 0 ? inputMask : null
43+
mask: focusGrab.active || panels.popouts.isDetached || Hypr.focusedMonitor?.activeWorkspace?.lastIpcObject.windows > 0 ? inputMask : null
4444

4545
anchors.top: true
4646
anchors.bottom: true
@@ -78,12 +78,14 @@ Variants {
7878
HyprlandFocusGrab {
7979
id: focusGrab
8080

81-
active: (visibilities.launcher && Config.launcher.enabled) || (visibilities.session && Config.session.enabled) || (visibilities.sidebar && Config.sidebar.enabled)
81+
active: (visibilities.launcher && Config.launcher.enabled) || (visibilities.session && Config.session.enabled) || (visibilities.sidebar && Config.sidebar.enabled) || (!Config.dashboard.showOnHover && visibilities.dashboard && Config.dashboard.enabled) || (panels.popouts.currentName.startsWith("traymenu") && panels.popouts.current?.depth > 1)
8282
windows: [win]
8383
onCleared: {
8484
visibilities.launcher = false;
8585
visibilities.session = false;
8686
visibilities.sidebar = false;
87+
visibilities.dashboard = false;
88+
panels.popouts.hasCurrent = false;
8789
}
8890
}
8991

modules/drawers/Interactions.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ CustomMouseArea {
6868
if (!utilitiesShortcutActive)
6969
visibilities.utilities = false;
7070

71-
if (!popouts.currentName.startsWith("traymenu") || popouts.current?.depth <= 1)
71+
if (!popouts.currentName.startsWith("traymenu") || (popouts.current?.depth ?? 0) <= 1)
7272
popouts.hasCurrent = false;
7373

7474
if (Config.bar.showOnHover)
@@ -199,7 +199,7 @@ CustomMouseArea {
199199
// Show popouts on hover
200200
if (x < bar.implicitWidth)
201201
bar.checkPopout(y);
202-
else if (!popouts.currentName.startsWith("traymenu") && !inLeftPanel(panels.popouts, x, y))
202+
else if ((!popouts.currentName.startsWith("traymenu") || (popouts.current?.depth ?? 0) <= 1) && !inLeftPanel(panels.popouts, x, y))
203203
popouts.hasCurrent = false;
204204
}
205205

0 commit comments

Comments
 (0)