summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-13 17:06:21 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-13 17:06:21 +1000
commit1656e5c3556fafd388510cd6728e064c802d9e25 (patch)
tree701523457f71370a97ec952f2fd75e2ef266a4be
parentrefactor: move to single window (diff)
downloadcaelestia-shell-1656e5c3556fafd388510cd6728e064c802d9e25.tar.gz
caelestia-shell-1656e5c3556fafd388510cd6728e064c802d9e25.tar.bz2
caelestia-shell-1656e5c3556fafd388510cd6728e064c802d9e25.zip
osd: show on hover
-rw-r--r--modules/drawers/Drawers.qml18
-rw-r--r--modules/drawers/Interactions.qml15
-rw-r--r--modules/drawers/Panels.qml5
-rw-r--r--modules/osd/Wrapper.qml3
-rw-r--r--services/Drawers.qml34
5 files changed, 32 insertions, 43 deletions
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
diff --git a/services/Drawers.qml b/services/Drawers.qml
deleted file mode 100644
index 7e7d97a..0000000
--- a/services/Drawers.qml
+++ /dev/null
@@ -1,34 +0,0 @@
-pragma Singleton
-
-import Quickshell
-import QtQuick
-
-Singleton {
- id: root
-
- property var visibilities: Quickshell.screens.reduce((acc, s) => {
- acc[s] = visibleComp.createObject(root);
- return acc;
- }, {})
-
- property var positions: ({})
- property int rightExclusion
-
- signal posChanged(screen: ShellScreen, x: int, y: int)
-
- function setPosForScreen(screen: ShellScreen, x: int, y: int): void {
- positions[screen] = Qt.point(x, y);
- posChanged(screen, x, y);
- }
-
- Component {
- id: visibleComp
-
- QtObject {
- property bool launcher
- property bool osd
- property bool notifs
- property bool session
- }
- }
-}