From 85d575f6c18017693cb2f3ab07314a0cf43adbe6 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Thu, 18 Sep 2025 15:19:15 +1000 Subject: feat: add sidebar WIP --- modules/drawers/Backgrounds.qml | 17 +++++++-- modules/drawers/Drawers.qml | 4 ++- modules/drawers/Interactions.qml | 77 +++++++++++++++++++++++++++++----------- modules/drawers/Panels.qml | 23 ++++++++++-- 4 files changed, 94 insertions(+), 27 deletions(-) (limited to 'modules/drawers') diff --git a/modules/drawers/Backgrounds.qml b/modules/drawers/Backgrounds.qml index e1773a1..7fa2ca1 100644 --- a/modules/drawers/Backgrounds.qml +++ b/modules/drawers/Backgrounds.qml @@ -7,6 +7,7 @@ import qs.modules.launcher as Launcher import qs.modules.dashboard as Dashboard import qs.modules.bar.popouts as BarPopouts import qs.modules.utilities as Utilities +import qs.modules.sidebar as Sidebar import QtQuick import QtQuick.Shapes @@ -24,12 +25,13 @@ Shape { Osd.Background { wrapper: root.panels.osd - startX: root.width - root.panels.session.width + startX: root.width - root.panels.session.width - root.panels.sidebar.width startY: (root.height - wrapper.height) / 2 - rounding } Notifications.Background { wrapper: root.panels.notifications + sidebar: sidebar startX: root.width startY: 0 @@ -38,7 +40,7 @@ Shape { Session.Background { wrapper: root.panels.session - startX: root.width + startX: root.width - root.panels.sidebar.width startY: (root.height - wrapper.height) / 2 - rounding } @@ -66,8 +68,19 @@ Shape { Utilities.Background { wrapper: root.panels.utilities + sidebar: sidebar startX: root.width startY: root.height } + + Sidebar.Background { + id: sidebar + + wrapper: root.panels.sidebar + panels: root.panels + + startX: root.width + startY: root.panels.notifications.height + } } diff --git a/modules/drawers/Drawers.qml b/modules/drawers/Drawers.qml index 5e5e992..3503697 100644 --- a/modules/drawers/Drawers.qml +++ b/modules/drawers/Drawers.qml @@ -72,11 +72,12 @@ Variants { } HyprlandFocusGrab { - active: (visibilities.launcher && Config.launcher.enabled) || (visibilities.session && Config.session.enabled) + active: (visibilities.launcher && Config.launcher.enabled) || (visibilities.session && Config.session.enabled) || (visibilities.sidebar && Config.sidebar.enabled) windows: [win] onCleared: { visibilities.launcher = false; visibilities.session = false; + visibilities.sidebar = false; } } @@ -119,6 +120,7 @@ Variants { property bool launcher property bool dashboard property bool utilities + property bool sidebar Component.onCompleted: Visibilities.load(scope.modelData, this) } diff --git a/modules/drawers/Interactions.qml b/modules/drawers/Interactions.qml index 99aa267..84714b5 100644 --- a/modules/drawers/Interactions.qml +++ b/modules/drawers/Interactions.qml @@ -82,6 +82,8 @@ CustomMouseArea { const x = event.x; const y = event.y; + const dragX = x - dragStart.x; + const dragY = y - dragStart.y; // Show bar in non-exclusive mode on hover if (!visibilities.bar && Config.bar.showOnHover && x < bar.implicitWidth) @@ -89,33 +91,68 @@ CustomMouseArea { // Show/hide bar on drag if (pressed && dragStart.x < bar.implicitWidth) { - const dragX = x - dragStart.x; if (dragX > Config.bar.dragThreshold) visibilities.bar = true; else if (dragX < -Config.bar.dragThreshold) visibilities.bar = false; } - // Show osd on hover - const showOsd = inRightPanel(panels.osd, x, y); + if (panels.sidebar.width === 0) { + // Show osd on hover + const showOsd = inRightPanel(panels.osd, x, y); - // Always update visibility based on hover if not in shortcut mode - if (!osdShortcutActive) { - visibilities.osd = showOsd; - root.panels.osd.hovered = showOsd; - } else if (showOsd) { - // If hovering over OSD area while in shortcut mode, transition to hover control - osdShortcutActive = false; - root.panels.osd.hovered = true; - } + // Always update visibility based on hover if not in shortcut mode + if (!osdShortcutActive) { + visibilities.osd = showOsd; + root.panels.osd.hovered = showOsd; + } else if (showOsd) { + // If hovering over OSD area while in shortcut mode, transition to hover control + osdShortcutActive = false; + root.panels.osd.hovered = true; + } + + const showSidebar = pressed && dragStart.x > bar.implicitWidth + panels.sidebar.x; + + // Show/hide session on drag + if (pressed && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) { + if (dragX < -Config.session.dragThreshold) + visibilities.session = true; + else if (dragX > Config.session.dragThreshold) + visibilities.session = false; + + // Show sidebar on drag if in session area and session is nearly fully visible + if (showSidebar && panels.session.width >= panels.session.nonAnimWidth && dragX < -Config.sidebar.dragThreshold) + visibilities.sidebar = true; + } else if (showSidebar && dragX < -Config.sidebar.dragThreshold) { + // Show sidebar on drag if not in session area + visibilities.sidebar = true; + } + } else { + const outOfSidebar = x < width - panels.sidebar.width; + // Show osd on hover + const showOsd = outOfSidebar && inRightPanel(panels.osd, x, y); + + // Always update visibility based on hover if not in shortcut mode + if (!osdShortcutActive) { + visibilities.osd = showOsd; + root.panels.osd.hovered = showOsd; + } else if (showOsd) { + // If hovering over OSD area while in shortcut mode, transition to hover control + osdShortcutActive = false; + root.panels.osd.hovered = true; + } + + // Show/hide session on drag + if (pressed && outOfSidebar && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) { + if (dragX < -Config.session.dragThreshold) + visibilities.session = true; + else if (dragX > Config.session.dragThreshold) + visibilities.session = false; + } - // Show/hide session on drag - if (pressed && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) { - const dragX = x - dragStart.x; - if (dragX < -Config.session.dragThreshold) - visibilities.session = true; - else if (dragX > Config.session.dragThreshold) - visibilities.session = false; + // Hide sidebar on drag + if (pressed && inRightPanel(panels.sidebar, dragStart.x, 0) && dragX > Config.sidebar.dragThreshold) + visibilities.sidebar = false; } // Show launcher on hover, or show/hide on drag if hover is disabled @@ -123,7 +160,6 @@ CustomMouseArea { if (!visibilities.launcher && inBottomPanel(panels.launcher, x, y)) visibilities.launcher = true; } else if (pressed && inBottomPanel(panels.launcher, dragStart.x, dragStart.y) && withinPanelWidth(panels.launcher, x, y)) { - const dragY = y - dragStart.y; if (dragY < -Config.launcher.dragThreshold) visibilities.launcher = true; else if (dragY > Config.launcher.dragThreshold) @@ -143,7 +179,6 @@ CustomMouseArea { // Show/hide dashboard on drag (for touchscreen devices) if (pressed && inTopPanel(panels.dashboard, dragStart.x, dragStart.y) && withinPanelWidth(panels.dashboard, x, y)) { - const dragY = y - dragStart.y; if (dragY > Config.dashboard.dragThreshold) visibilities.dashboard = true; else if (dragY < -Config.dashboard.dragThreshold) diff --git a/modules/drawers/Panels.qml b/modules/drawers/Panels.qml index ed21f80..7896ddb 100644 --- a/modules/drawers/Panels.qml +++ b/modules/drawers/Panels.qml @@ -6,6 +6,7 @@ import qs.modules.launcher as Launcher import qs.modules.dashboard as Dashboard import qs.modules.bar.popouts as BarPopouts import qs.modules.utilities as Utilities +import qs.modules.sidebar as Sidebar import Quickshell import QtQuick @@ -23,6 +24,7 @@ Item { readonly property Dashboard.Wrapper dashboard: dashboard readonly property BarPopouts.Wrapper popouts: popouts readonly property Utilities.Wrapper utilities: utilities + readonly property Sidebar.Wrapper sidebar: sidebar anchors.fill: parent anchors.margins: Config.border.thickness @@ -31,20 +33,20 @@ Item { Osd.Wrapper { id: osd - clip: root.visibilities.session + clip: session.width > 0 || sidebar.width > 0 screen: root.screen visibilities: root.visibilities anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: session.width + anchors.rightMargin: session.width + sidebar.width } Notifications.Wrapper { id: notifications visibilities: root.visibilities - panel: root + panels: root anchors.top: parent.top anchors.right: parent.right @@ -53,10 +55,13 @@ Item { Session.Wrapper { id: session + clip: sidebar.width > 0 visibilities: root.visibilities + panels: root anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right + anchors.rightMargin: sidebar.width } Launcher.Wrapper { @@ -101,8 +106,20 @@ Item { id: utilities visibilities: root.visibilities + sidebar: sidebar anchors.bottom: parent.bottom anchors.right: parent.right } + + Sidebar.Wrapper { + id: sidebar + + visibilities: root.visibilities + panels: root + + anchors.top: notifications.bottom + anchors.bottom: utilities.top + anchors.right: parent.right + } } -- cgit v1.2.3-freya