diff options
| author | Tim Hämisch <haemtim@gmail.com> | 2025-06-13 16:08:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-14 00:08:02 +1000 |
| commit | 4621c3695ed26862af70901605172bb1acaaae91 (patch) | |
| tree | 5b1efa1fec3d403813f6903192c6a9ff7b74e9b7 /modules/drawers | |
| parent | internal: better caching impl (diff) | |
| download | caelestia-shell-4621c3695ed26862af70901605172bb1acaaae91.tar.gz caelestia-shell-4621c3695ed26862af70901605172bb1acaaae91.tar.bz2 caelestia-shell-4621c3695ed26862af70901605172bb1acaaae91.zip | |
Add custom shortcut for launcher, dashboard and osd all in one (#53)
* Add custom shortcut for launcher, dashboard and osd all in one
* Fix Shortcut description
* shortcuts: fix showall
Some fixes:
- no need for the complex shortcut
- fix formatting
- fix unqualified access
---------
Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Diffstat (limited to 'modules/drawers')
| -rw-r--r-- | modules/drawers/Interactions.qml | 86 |
1 files changed, 80 insertions, 6 deletions
diff --git a/modules/drawers/Interactions.qml b/modules/drawers/Interactions.qml index 3ec522b..10e37a8 100644 --- a/modules/drawers/Interactions.qml +++ b/modules/drawers/Interactions.qml @@ -16,6 +16,8 @@ MouseArea { property bool osdHovered property point dragStart + property bool dashboardShortcutActive + property bool osdShortcutActive function withinPanelHeight(panel: Item, x: real, y: real): bool { const panelY = BorderConfig.thickness + panel.y; @@ -37,9 +39,14 @@ MouseArea { onPressed: event => dragStart = Qt.point(event.x, event.y) onContainsMouseChanged: { if (!containsMouse) { - visibilities.osd = false; - osdHovered = false; - visibilities.dashboard = false; + // Only hide if not activated by shortcut + if (!osdShortcutActive) { + visibilities.osd = false; + osdHovered = false; + } + if (!dashboardShortcutActive) { + visibilities.dashboard = false; + } popouts.hasCurrent = false; } } @@ -47,8 +54,16 @@ MouseArea { onPositionChanged: ({x, y}) => { // Show osd on hover const showOsd = inRightPanel(panels.osd, x, y); - visibilities.osd = showOsd; - osdHovered = showOsd; + + // Always update visibility based on hover if not in shortcut mode + if (!osdShortcutActive) { + visibilities.osd = showOsd; + osdHovered = showOsd; + } else if (showOsd) { + // If hovering over OSD area while in shortcut mode, transition to hover control + osdShortcutActive = false; + osdHovered = true; + } // Show/hide session on drag if (pressed && withinPanelHeight(panels.session, x, y)) { @@ -60,7 +75,15 @@ MouseArea { } // Show dashboard on hover - visibilities.dashboard = inTopPanel(panels.dashboard, x, y); + const showDashboard = inTopPanel(panels.dashboard, x, y); + + // Always update visibility based on hover if not in shortcut mode + if (!dashboardShortcutActive) { + visibilities.dashboard = showDashboard; + } else if (showDashboard) { + // If hovering over dashboard area while in shortcut mode, transition to hover control + dashboardShortcutActive = false; + } // Show popouts on hover const popout = panels.popouts; @@ -75,6 +98,57 @@ MouseArea { popouts.hasCurrent = false; } + // Monitor individual visibility changes + Connections { + target: root.visibilities + + function onLauncherChanged() { + // If launcher is hidden, clear shortcut flags for dashboard and OSD + if (!root.visibilities.launcher) { + root.dashboardShortcutActive = false; + root.osdShortcutActive = false; + + // Also hide dashboard and OSD if they're not being hovered + const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY); + const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY); + + if (!inDashboardArea) { + root.visibilities.dashboard = false; + } + if (!inOsdArea) { + root.visibilities.osd = false; + root.osdHovered = false; + } + } + } + + function onDashboardChanged() { + if (root.visibilities.dashboard) { + // Dashboard became visible, immediately check if this should be shortcut mode + const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY); + if (!inDashboardArea) { + root.dashboardShortcutActive = true; + } + } else { + // Dashboard hidden, clear shortcut flag + root.dashboardShortcutActive = false; + } + } + + function onOsdChanged() { + if (root.visibilities.osd) { + // OSD became visible, immediately check if this should be shortcut mode + const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY); + if (!inOsdArea) { + root.osdShortcutActive = true; + } + } else { + // OSD hidden, clear shortcut flag + root.osdShortcutActive = false; + } + } + } + Osd.Interactions { screen: root.screen visibilities: root.visibilities |