From 1656e5c3556fafd388510cd6728e064c802d9e25 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 13 May 2025 17:06:21 +1000 Subject: osd: show on hover --- modules/drawers/Drawers.qml | 18 ++++++++++++++---- modules/drawers/Interactions.qml | 15 +++++++++++++-- modules/drawers/Panels.qml | 5 +++-- modules/osd/Wrapper.qml | 3 ++- 4 files changed, 32 insertions(+), 9 deletions(-) (limited to 'modules') diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml index d8f242b..937409a 100644 --- a/modules/drawers/Drawers.qml +++ b/modules/drawers/Drawers.qml @@ -70,14 +70,24 @@ Variants { source: background } - Panels { - id: panels + PersistentProperties { + id: visibilities - screen: scope.modelData + property bool launcher + property bool osd + property bool notifs + property bool session } Interactions { - screen: scope.modelData + visibilities: visibilities + + Panels { + id: panels + + screen: scope.modelData + visibilities: visibilities + } } } } diff --git a/modules/drawers/Interactions.qml b/modules/drawers/Interactions.qml index 5006a96..aab23aa 100644 --- a/modules/drawers/Interactions.qml +++ b/modules/drawers/Interactions.qml @@ -1,11 +1,22 @@ import "root:/services" +import "root:/config" import Quickshell import QtQuick MouseArea { - required property ShellScreen screen + required property PersistentProperties visibilities + + property point dragStart anchors.fill: parent hoverEnabled: true - onPositionChanged: event => Drawers.setPosForScreen(screen, event.x, event.y) + + 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); + } } diff --git a/modules/drawers/Panels.qml b/modules/drawers/Panels.qml index fd56f1b..06b4a09 100644 --- a/modules/drawers/Panels.qml +++ b/modules/drawers/Panels.qml @@ -1,5 +1,3 @@ -import "root:/widgets" -import "root:/services" import "root:/config" import "root:/modules/osd" as Osd import Quickshell @@ -9,6 +7,8 @@ Item { id: root required property ShellScreen screen + required property PersistentProperties visibilities + readonly property Osd.Wrapper osd: osd anchors.fill: parent @@ -18,6 +18,7 @@ Item { id: osd screen: root.screen + visibility: visibilities.osd anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right diff --git a/modules/osd/Wrapper.qml b/modules/osd/Wrapper.qml index e56fa2b..56479ad 100644 --- a/modules/osd/Wrapper.qml +++ b/modules/osd/Wrapper.qml @@ -7,6 +7,7 @@ Item { id: root required property ShellScreen screen + required property bool visibility visible: width > 0 implicitWidth: 0 @@ -14,7 +15,7 @@ Item { states: State { name: "visible" - when: Drawers.visibilities[root.screen].osd + when: root.visibility PropertyChanges { root.implicitWidth: content.width -- cgit v1.2.3-freya