From 96429160c30ba5f6dcd25c8e6a181221195c41d8 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 15 Jun 2025 18:08:45 +1000 Subject: feat: user config file Config file at `~/.config/caelestia/shell.json` --- modules/notifications/Background.qml | 6 +++--- modules/notifications/Content.qml | 10 +++++----- modules/notifications/Notification.qml | 22 +++++++++++----------- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'modules/notifications') diff --git a/modules/notifications/Background.qml b/modules/notifications/Background.qml index 2fd05f8..4a38510 100644 --- a/modules/notifications/Background.qml +++ b/modules/notifications/Background.qml @@ -8,13 +8,13 @@ ShapePath { id: root required property Wrapper wrapper - readonly property real rounding: BorderConfig.rounding + 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 - BorderConfig.thickness * 2 ? -rounding : rounding + property real fullHeightRounding: wrapper.height >= QsWindow.window?.height - Config.border.thickness * 2 ? -rounding : rounding strokeWidth: -1 - fillColor: BorderConfig.colour + fillColor: Config.border.colour PathLine { relativeX: -(root.wrapper.width + root.rounding) diff --git a/modules/notifications/Content.qml b/modules/notifications/Content.qml index a64ccb9..6983b95 100644 --- a/modules/notifications/Content.qml +++ b/modules/notifications/Content.qml @@ -14,7 +14,7 @@ Item { anchors.bottom: parent.bottom anchors.right: parent.right - implicitWidth: NotifsConfig.sizes.width + padding * 2 + implicitWidth: Config.notifs.sizes.width + padding * 2 implicitHeight: { const count = list.count; if (count === 0) @@ -29,19 +29,19 @@ Item { const panel = Visibilities.panels[screen]; if (visibilities && panel) { if (visibilities.osd) { - const h = panel.osd.y - BorderConfig.rounding * 2; + const h = panel.osd.y - Config.border.rounding * 2; if (height > h) height = h; } if (visibilities.session) { - const h = panel.session.y - BorderConfig.rounding * 2; + const h = panel.session.y - Config.border.rounding * 2; if (height > h) height = h; } } - return Math.min((screen?.height ?? 0) - BorderConfig.thickness * 2, height + padding * 2); + return Math.min((screen?.height ?? 0) - Config.border.thickness * 2, height + padding * 2); } ClippingWrapperRectangle { @@ -108,7 +108,7 @@ Item { Anim { target: notif property: "x" - to: (notif.x >= 0 ? NotifsConfig.sizes.width : -NotifsConfig.sizes.width) * 2 + to: (notif.x >= 0 ? Config.notifs.sizes.width : -Config.notifs.sizes.width) * 2 duration: Appearance.anim.durations.normal easing.bezierCurve: Appearance.anim.curves.emphasized } diff --git a/modules/notifications/Notification.qml b/modules/notifications/Notification.qml index 848eac4..ebc5ce6 100644 --- a/modules/notifications/Notification.qml +++ b/modules/notifications/Notification.qml @@ -20,10 +20,10 @@ StyledRect { color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer radius: Appearance.rounding.normal - implicitWidth: NotifsConfig.sizes.width + implicitWidth: Config.notifs.sizes.width implicitHeight: inner.implicitHeight - x: NotifsConfig.sizes.width + x: Config.notifs.sizes.width Component.onCompleted: x = 0 RetainableLock { @@ -52,7 +52,7 @@ StyledRect { root.modelData.notification.dismiss(); } onReleased: event => { - if (Math.abs(root.x) < NotifsConfig.sizes.width * NotifsConfig.clearThreshold) + if (Math.abs(root.x) < Config.notifs.sizes.width * Config.notifs.clearThreshold) root.x = 0; else root.modelData.popup = false; @@ -60,12 +60,12 @@ StyledRect { onPositionChanged: event => { if (pressed) { const diffY = event.y - startY; - if (Math.abs(diffY) > NotifsConfig.expandThreshold) + if (Math.abs(diffY) > Config.notifs.expandThreshold) root.expanded = diffY > 0; } } onClicked: event => { - if (!NotifsConfig.actionOnClick || event.button !== Qt.LeftButton) + if (!Config.notifs.actionOnClick || event.button !== Qt.LeftButton) return; const actions = root.modelData.actions; @@ -107,14 +107,14 @@ StyledRect { anchors.left: parent.left anchors.top: parent.top - width: NotifsConfig.sizes.image - height: NotifsConfig.sizes.image + width: Config.notifs.sizes.image + height: Config.notifs.sizes.image visible: root.hasImage || root.hasAppIcon sourceComponent: ClippingRectangle { radius: Appearance.rounding.full - implicitWidth: NotifsConfig.sizes.image - implicitHeight: NotifsConfig.sizes.image + implicitWidth: Config.notifs.sizes.image + implicitHeight: Config.notifs.sizes.image Image { anchors.fill: parent @@ -140,8 +140,8 @@ StyledRect { sourceComponent: StyledRect { radius: Appearance.rounding.full color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3error : root.modelData.urgency === NotificationUrgency.Low ? Colours.palette.m3surfaceContainerHighest : Colours.palette.m3tertiaryContainer - implicitWidth: root.hasImage ? NotifsConfig.sizes.badge : NotifsConfig.sizes.image - implicitHeight: root.hasImage ? NotifsConfig.sizes.badge : NotifsConfig.sizes.image + implicitWidth: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image + implicitHeight: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image Loader { id: icon -- cgit v1.2.3-freya