Skip to content

Commit b7b71e1

Browse files
feat: add sidebar showOnHover support and drawers isOpen IPC (caelestia-dots#1505)
* feat: add sidebar showOnHover support and drawers isOpen IPC - Add showOnHover property to SidebarConfig (defaults to false) - Show sidebar on hover when cursor enters top-right corner - Hide sidebar when cursor leaves sidebar area or exits screen - Add sidebarShortcutActive flag to preserve shortcut-triggered state - Add isOpen(drawer) to drawers IPC target for external state queries Closes caelestia-dots#226 * docs: add sidebar showOnHover to config reference * style: apply qmlformat to Shortcuts.qml * fixes --------- Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
1 parent 7999576 commit b7b71e1

4 files changed

Lines changed: 35 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,8 @@ For example, to disable the bar on DP-1:
728728
},
729729
"sidebar": {
730730
"enabled": true,
731+
"showOnHover": false,
732+
"minHoverThreshold": 200,
731733
"dragThreshold": 80
732734
},
733735
"utilities": {

modules/Shortcuts.qml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ Scope {
125125
return Object.keys(visibilities).filter(k => typeof visibilities[k] === "boolean").join("\n");
126126
}
127127

128+
function isOpen(drawer: string): string {
129+
const visibilities = Visibilities.getForActive();
130+
if (typeof visibilities[drawer] !== "boolean")
131+
return "unknown";
132+
return visibilities[drawer] ? "1" : "0";
133+
}
134+
128135
target: "drawers"
129136
}
130137

modules/drawers/Interactions.qml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ CustomMouseArea {
8585

8686
if (Config.bar.showOnHover)
8787
bar.isHovered = false;
88+
89+
if (Config.sidebar.showOnHover)
90+
visibilities.sidebar = false;
8891
}
8992
}
9093

@@ -130,6 +133,14 @@ CustomMouseArea {
130133

131134
const showSidebar = pressed && dragStart.x > Math.min(width - Config.border.minThickness, bar.implicitWidth + panels.sidebar.x);
132135

136+
// Show sidebar on hover (top-right corner, bounded by notification panel height)
137+
if (Config.sidebar.showOnHover) {
138+
const sidebarTriggerY = Math.max(Config.sidebar.minHoverThreshold, panels.notifications.y + panels.notifications.height + borderThickness);
139+
const showSidebarHover = x > Math.min(width - Config.border.minThickness, bar.implicitWidth + panels.sidebar.x) && y <= sidebarTriggerY;
140+
if (showSidebarHover && !visibilities.sidebar)
141+
visibilities.sidebar = true;
142+
}
143+
133144
// Show/hide session on drag
134145
if (pressed && inRightPanel(panels.sessionWrapper, dragStart.x, dragStart.y) && withinPanelHeight(panels.sessionWrapper, x, y)) {
135146
if (dragX < -Config.session.dragThreshold)
@@ -167,6 +178,19 @@ CustomMouseArea {
167178
visibilities.session = false;
168179
}
169180

181+
// Show/hide sidebar on hover
182+
if (Config.sidebar.showOnHover && !pressed) {
183+
const sidebarTriggerY = Math.max(Config.sidebar.minHoverThreshold, panels.notifications.y + panels.notifications.height + borderThickness);
184+
const showSidebarHover = x > Math.min(width - Config.border.minThickness, bar.implicitWidth + panels.sidebar.x) && y <= sidebarTriggerY;
185+
if (showSidebarHover && !visibilities.sidebar) {
186+
visibilities.sidebar = true;
187+
} else {
188+
const inSidebarArea = inRightPanel(panels.sidebar, x, y) || inRightPanel(panels.sessionWrapper, x, y);
189+
if (!inSidebarArea)
190+
visibilities.sidebar = false;
191+
}
192+
}
193+
170194
// Hide sidebar on drag
171195
if (pressed && inRightPanel(panels.sidebar, dragStart.x, 0) && dragX > Config.sidebar.dragThreshold)
172196
visibilities.sidebar = false;

plugin/src/Caelestia/Config/sidebarconfig.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class SidebarConfig : public ConfigObject {
99
QML_ANONYMOUS
1010

1111
CONFIG_PROPERTY(bool, enabled, true)
12+
CONFIG_PROPERTY(bool, showOnHover, false)
13+
CONFIG_PROPERTY(int, minHoverThreshold, 200)
1214
CONFIG_PROPERTY(int, dragThreshold, 80)
1315

1416
public:

0 commit comments

Comments
 (0)