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/notifications/Background.qml | 15 +++++---------- modules/notifications/Content.qml | 8 ++++---- modules/notifications/Wrapper.qml | 28 +++++++++++++++++++++++----- 3 files changed, 32 insertions(+), 19 deletions(-) (limited to 'modules/notifications') diff --git a/modules/notifications/Background.qml b/modules/notifications/Background.qml index 47ec54a..a44cb19 100644 --- a/modules/notifications/Background.qml +++ b/modules/notifications/Background.qml @@ -1,7 +1,6 @@ import qs.components import qs.services import qs.config -import Quickshell import QtQuick import QtQuick.Shapes @@ -9,10 +8,10 @@ ShapePath { id: root required property Wrapper wrapper + required property var sidebar readonly property real rounding: Config.border.rounding readonly property bool flatten: wrapper.height < rounding * 2 readonly property real roundingY: flatten ? wrapper.height / 2 : rounding - property real fullHeightRounding: wrapper.height >= QsWindow.window?.height - Config.border.thickness * 2 ? -rounding : rounding strokeWidth: -1 fillColor: Colours.palette.m3surface @@ -32,14 +31,14 @@ ShapePath { relativeY: root.wrapper.height - root.roundingY * 2 } PathArc { - relativeX: root.fullHeightRounding + relativeX: root.sidebar.notifsRoundingX relativeY: root.roundingY - radiusX: Math.abs(root.fullHeightRounding) + radiusX: root.sidebar.notifsRoundingX radiusY: Math.min(root.rounding, root.wrapper.height) - direction: root.fullHeightRounding < 0 ? PathArc.Clockwise : PathArc.Counterclockwise + direction: PathArc.Counterclockwise } PathLine { - relativeX: root.wrapper.height > 0 ? root.wrapper.width - root.rounding - root.fullHeightRounding : root.wrapper.width + relativeX: root.wrapper.height > 0 ? root.wrapper.width - root.rounding - root.sidebar.notifsRoundingX : root.wrapper.width relativeY: 0 } PathArc { @@ -52,8 +51,4 @@ ShapePath { Behavior on fillColor { CAnim {} } - - Behavior on fullHeightRounding { - Anim {} - } } diff --git a/modules/notifications/Content.qml b/modules/notifications/Content.qml index 2ece7f4..828c3a8 100644 --- a/modules/notifications/Content.qml +++ b/modules/notifications/Content.qml @@ -10,7 +10,7 @@ Item { id: root required property PersistentProperties visibilities - required property Item panel + required property Item panels readonly property int padding: Appearance.padding.large anchors.top: parent.top @@ -27,15 +27,15 @@ Item { for (let i = 0; i < count; i++) height += list.itemAtIndex(i)?.nonAnimHeight ?? 0; - if (visibilities && panel) { + if (visibilities && panels) { if (visibilities.osd) { - const h = panel.osd.y - Config.border.rounding * 2 - padding * 2; + const h = panels.osd.y - Config.border.rounding * 2 - padding * 2; if (height > h) height = h; } if (visibilities.session) { - const h = panel.session.y - Config.border.rounding * 2 - padding * 2; + const h = panels.session.y - Config.border.rounding * 2 - padding * 2; if (height > h) height = h; } diff --git a/modules/notifications/Wrapper.qml b/modules/notifications/Wrapper.qml index 47655ac..61acc56 100644 --- a/modules/notifications/Wrapper.qml +++ b/modules/notifications/Wrapper.qml @@ -1,21 +1,39 @@ +import qs.components import qs.config -import Quickshell import QtQuick Item { id: root - required property PersistentProperties visibilities - required property Item panel + required property var visibilities + required property Item panels visible: height > 0 + implicitWidth: Math.max(panels.sidebar.width, content.implicitWidth) implicitHeight: content.implicitHeight - implicitWidth: content.implicitWidth + + states: State { + name: "hidden" + when: root.visibilities.sidebar && Config.sidebar.enabled + + PropertyChanges { + root.implicitHeight: 0 + } + } + + transitions: Transition { + Anim { + target: root + property: "implicitHeight" + duration: Appearance.anim.durations.expressiveDefaultSpatial + easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial + } + } Content { id: content visibilities: root.visibilities - panel: root.panel + panels: root.panels } } -- cgit v1.2.3-freya