summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-13 19:15:02 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-13 19:15:02 +1000
commitea4aedd6258973319232cf2b49075ec1701351b9 (patch)
treeabfd6a4ab591355d527328b2896348144c73488a /modules
parentsession: move to drawers (diff)
downloadcaelestia-shell-ea4aedd6258973319232cf2b49075ec1701351b9.tar.gz
caelestia-shell-ea4aedd6258973319232cf2b49075ec1701351b9.tar.bz2
caelestia-shell-ea4aedd6258973319232cf2b49075ec1701351b9.zip
session: show/hide on drag
Diffstat (limited to 'modules')
-rw-r--r--modules/drawers/Interactions.qml20
-rw-r--r--modules/drawers/Panels.qml1
2 files changed, 17 insertions, 4 deletions
diff --git a/modules/drawers/Interactions.qml b/modules/drawers/Interactions.qml
index bd76944..884d36c 100644
--- a/modules/drawers/Interactions.qml
+++ b/modules/drawers/Interactions.qml
@@ -13,9 +13,12 @@ MouseArea {
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;
+ function withinPanelHeight(panel: Item, x: real, y: real): bool {
+ return y >= panel.y && y <= panel.y + panel.height;
+ }
+
+ function inRightPanel(panel: Item, x: real, y: real): bool {
+ return x > panel.x && withinPanelHeight(panel, x, y);
}
anchors.fill: parent
@@ -30,9 +33,18 @@ MouseArea {
const {x, y} = Hyprland.cursorPos;
// Show osd on hover
- const showOsd = root.inOsd(x, y);
+ 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;
+ }
}
}
diff --git a/modules/drawers/Panels.qml b/modules/drawers/Panels.qml
index fb1a9f5..c903fff 100644
--- a/modules/drawers/Panels.qml
+++ b/modules/drawers/Panels.qml
@@ -21,6 +21,7 @@ Item {
Osd.Wrapper {
id: osd
+ clip: root.visibilities.session
screen: root.screen
visibility: root.visibilities.osd