From d8153f7611bfd5f4ae744bd08e11c4bc35d55d16 Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 25 Nov 2025 22:35:38 -0500 Subject: [PATCH] dankbar: improve config reactivity --- quickshell/DMSShell.qml | 15 ++++++++++++--- quickshell/Modules/DankBar/BarCanvas.qml | 10 +++++----- quickshell/Modules/Settings/DankBarTab.qml | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/quickshell/DMSShell.qml b/quickshell/DMSShell.qml index 780ec89b..cf47edfc 100644 --- a/quickshell/DMSShell.qml +++ b/quickshell/DMSShell.qml @@ -106,18 +106,27 @@ Item { Repeater { id: dankBarRepeater model: ScriptModel { - values: SettingsData.barConfigs + id: barRepeaterModel + values: { + const configs = SettingsData.barConfigs; + return configs.map(c => ({ + id: c.id, + position: c.position + })); + } } property var hyprlandOverviewLoaderRef: hyprlandOverviewLoader delegate: Loader { id: barLoader - active: modelData.enabled + required property var modelData + property var barConfig: SettingsData.getBarConfig(modelData.id) + active: barConfig?.enabled ?? false asynchronous: false sourceComponent: DankBar { - barConfig: modelData + barConfig: barLoader.barConfig hyprlandOverviewLoader: dankBarRepeater.hyprlandOverviewLoaderRef onColorPickerRequested: { diff --git a/quickshell/Modules/DankBar/BarCanvas.qml b/quickshell/Modules/DankBar/BarCanvas.qml index b5e6880a..251d1d1e 100644 --- a/quickshell/Modules/DankBar/BarCanvas.qml +++ b/quickshell/Modules/DankBar/BarCanvas.qml @@ -115,7 +115,7 @@ Item { preferredRendererType: Shape.CurveRenderer readonly property real borderThickness: Math.max(1, barConfig?.borderThickness ?? 1) - readonly property real inset: 0.5 + readonly property real inset: 1 readonly property string borderColorKey: barConfig?.borderColor || "surfaceText" readonly property color baseColor: (borderColorKey === "surfaceText") ? Theme.surfaceText : (borderColorKey === "primary") ? Theme.primary : Theme.secondary readonly property color borderColor: Theme.withAlpha(baseColor, barConfig?.borderOpacity ?? 1.0) @@ -562,10 +562,10 @@ Item { } else { d = `M ${i + w} ${i + cr}`; if (cr > 0) - d += ` A ${cr} ${cr} 0 0 1 ${i + w - cr} ${i}`; + d += ` A ${cr} ${cr} 0 0 0 ${i + w - cr} ${i}`; d += ` L ${i + cr} ${i}`; if (cr > 0) - d += ` A ${cr} ${cr} 0 0 1 ${i} ${i + cr}`; + d += ` A ${cr} ${cr} 0 0 0 ${i} ${i + cr}`; } return d; } @@ -585,10 +585,10 @@ Item { } else { d = `M ${i + w - cr} ${i + h}`; if (cr > 0) - d += ` A ${cr} ${cr} 0 0 1 ${i + w} ${i + h - cr}`; + d += ` A ${cr} ${cr} 0 0 0 ${i + w} ${i + h - cr}`; d += ` L ${i + w} ${i + cr}`; if (cr > 0) - d += ` A ${cr} ${cr} 0 0 1 ${i + w - cr} ${i}`; + d += ` A ${cr} ${cr} 0 0 0 ${i + w - cr} ${i}`; } return d; } diff --git a/quickshell/Modules/Settings/DankBarTab.qml b/quickshell/Modules/Settings/DankBarTab.qml index 4acafc16..f12e3073 100644 --- a/quickshell/Modules/Settings/DankBarTab.qml +++ b/quickshell/Modules/Settings/DankBarTab.qml @@ -1570,7 +1570,7 @@ Item { position: newPos }); const isVertical = newPos === SettingsData.Position.Left || newPos === SettingsData.Position.Right; - if (!wasVertical && !isVertical) { + if (wasVertical !== isVertical || !isVertical) { notifyHorizontalBarChange(); } }