summaryrefslogtreecommitdiff
path: root/modules/drawers/Interactions.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-13 17:43:04 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-13 17:43:04 +1000
commit9c3e2fffbd31c3864ef7edc6212c1c601357f031 (patch)
tree78f45af391db6b7096da61342beceb3904e7819e /modules/drawers/Interactions.qml
parentosd: show on hover (diff)
downloadcaelestia-shell-9c3e2fffbd31c3864ef7edc6212c1c601357f031.tar.gz
caelestia-shell-9c3e2fffbd31c3864ef7edc6212c1c601357f031.tar.bz2
caelestia-shell-9c3e2fffbd31c3864ef7edc6212c1c601357f031.zip
osd: fix show on hover + show on audio/brightness change
Diffstat (limited to 'modules/drawers/Interactions.qml')
-rw-r--r--modules/drawers/Interactions.qml32
1 files changed, 27 insertions, 5 deletions
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
}
}