summaryrefslogtreecommitdiff
path: root/modules/drawers
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-27 10:01:33 +0800
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-27 10:01:33 +0800
commit7d1ee06807c5179b906ba79f7af6adce3016798a (patch)
tree5a89d6be4ac91117ec1b01650afdaf1fe81da9fb /modules/drawers
parentdrawers: fix interactions for multimonitor (diff)
downloadcaelestia-shell-7d1ee06807c5179b906ba79f7af6adce3016798a.tar.gz
caelestia-shell-7d1ee06807c5179b906ba79f7af6adce3016798a.tar.bz2
caelestia-shell-7d1ee06807c5179b906ba79f7af6adce3016798a.zip
drawers: dont use hyprland cursor pos
Use mousearea with positionChanged and containsMouse
Diffstat (limited to 'modules/drawers')
-rw-r--r--modules/drawers/Drawers.qml1
-rw-r--r--modules/drawers/Interactions.qml50
2 files changed, 25 insertions, 26 deletions
diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml
index d3d4bfa..d66f548 100644
--- a/modules/drawers/Drawers.qml
+++ b/modules/drawers/Drawers.qml
@@ -116,6 +116,7 @@ Variants {
Interactions {
screen: scope.modelData
visibilities: visibilities
+ panels: panels
Panels {
id: panels
diff --git a/modules/drawers/Interactions.qml b/modules/drawers/Interactions.qml
index e82f015..cd09140 100644
--- a/modules/drawers/Interactions.qml
+++ b/modules/drawers/Interactions.qml
@@ -9,6 +9,7 @@ MouseArea {
required property ShellScreen screen
required property PersistentProperties visibilities
+ required property Panels panels
property bool osdHovered
property point dragStart
@@ -31,35 +32,32 @@ MouseArea {
hoverEnabled: true
onPressed: event => dragStart = Qt.point(event.x, event.y)
+ onContainsMouseChanged: {
+ if (!containsMouse) {
+ visibilities.osd = false;
+ osdHovered = false;
+ visibilities.dashboard = false;
+ }
+ }
- Connections {
- target: Hyprland
-
- function onCursorPosChanged(): void {
- let {
- x,
- y
- } = Hyprland.cursorPos;
- x -= QsWindow.window.margins.left + Hyprland.focusedMonitor.x;
- y -= QsWindow.window.margins.top + Hyprland.focusedMonitor.y;
-
- // Show osd on hover
- const showOsd = root.inRightPanel(panels.osd, x, y);
- root.visibilities.osd = showOsd;
- root.osdHovered = showOsd;
-
- // Show/hide session on drag
- if (root.pressed && root.withinPanelHeight(panels.session, x, y)) {
- const dragX = x - root.dragStart.x;
- if (dragX < -SessionConfig.dragThreshold)
- root.visibilities.session = true;
- else if (dragX > SessionConfig.dragThreshold)
- root.visibilities.session = false;
- }
+ onPositionChanged: ({x, y}) => {
+ // Show osd on hover
+ const showOsd = inRightPanel(panels.osd, x, y);
+ visibilities.osd = showOsd;
+ osdHovered = showOsd;
- const showDashboard = root.inTopPanel(panels.dashboard, x, y);
- root.visibilities.dashboard = showDashboard;
+ // Show/hide session on drag
+ if (pressed && withinPanelHeight(panels.session, x, y)) {
+ const dragX = x - dragStart.x;
+ if (dragX < -SessionConfig.dragThreshold)
+ visibilities.session = true;
+ else if (dragX > SessionConfig.dragThreshold)
+ visibilities.session = false;
}
+
+ // Show dashboard on hover
+ const showDashboard = root.inTopPanel(panels.dashboard, x, y);
+ visibilities.dashboard = showDashboard;
}
Osd.Interactions {