diff options
Diffstat (limited to 'modules/drawers')
| -rw-r--r-- | modules/drawers/Drawers.qml | 1 | ||||
| -rw-r--r-- | modules/drawers/Interactions.qml | 32 |
2 files changed, 28 insertions, 5 deletions
diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml index 937409a..35129ce 100644 --- a/modules/drawers/Drawers.qml +++ b/modules/drawers/Drawers.qml @@ -80,6 +80,7 @@ Variants { } Interactions { + screen: scope.modelData visibilities: visibilities Panels { diff --git a/modules/drawers/Interactions.qml b/modules/drawers/Interactions.qml index aab23aa..bd76944 100644 --- a/modules/drawers/Interactions.qml +++ b/modules/drawers/Interactions.qml @@ -1,22 +1,44 @@ import "root:/services" import "root:/config" +import "root:/modules/osd" as Osd import Quickshell import QtQuick MouseArea { + id: root + + required property ShellScreen screen required property PersistentProperties visibilities + property bool osdHovered property point dragStart + function inOsd(x: real, y: real): bool { + const osd = panels.osd; + return x > width - BorderConfig.thickness - osd.width && y >= osd.y && y <= osd.y + osd.height; + } + anchors.fill: parent hoverEnabled: true onPressed: event => dragStart = Qt.point(event.x, event.y) - onExited: visibilities.osd = false - onPositionChanged: ({x, y}) => { - // Show osd on hover - const osd = panels.osd; - visibilities.osd = (x > width - BorderConfig.thickness - osd.width && y >= osd.y && y <= osd.y + osd.height); + Connections { + target: Hyprland + + function onCursorPosChanged(): void { + const {x, y} = Hyprland.cursorPos; + + // Show osd on hover + const showOsd = root.inOsd(x, y); + root.visibilities.osd = showOsd; + root.osdHovered = showOsd; + } + } + + Osd.Interactions { + screen: root.screen + visibilities: root.visibilities + hovered: root.osdHovered } } |