1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

dankbar: improve config reactivity

This commit is contained in:
bbedward
2025-11-25 22:35:38 -05:00
parent 8b6ae3f39b
commit d8153f7611
3 changed files with 18 additions and 9 deletions

View File

@@ -106,18 +106,27 @@ Item {
Repeater { Repeater {
id: dankBarRepeater id: dankBarRepeater
model: ScriptModel { 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 property var hyprlandOverviewLoaderRef: hyprlandOverviewLoader
delegate: Loader { delegate: Loader {
id: barLoader id: barLoader
active: modelData.enabled required property var modelData
property var barConfig: SettingsData.getBarConfig(modelData.id)
active: barConfig?.enabled ?? false
asynchronous: false asynchronous: false
sourceComponent: DankBar { sourceComponent: DankBar {
barConfig: modelData barConfig: barLoader.barConfig
hyprlandOverviewLoader: dankBarRepeater.hyprlandOverviewLoaderRef hyprlandOverviewLoader: dankBarRepeater.hyprlandOverviewLoaderRef
onColorPickerRequested: { onColorPickerRequested: {

View File

@@ -115,7 +115,7 @@ Item {
preferredRendererType: Shape.CurveRenderer preferredRendererType: Shape.CurveRenderer
readonly property real borderThickness: Math.max(1, barConfig?.borderThickness ?? 1) 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 string borderColorKey: barConfig?.borderColor || "surfaceText"
readonly property color baseColor: (borderColorKey === "surfaceText") ? Theme.surfaceText : (borderColorKey === "primary") ? Theme.primary : Theme.secondary 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) readonly property color borderColor: Theme.withAlpha(baseColor, barConfig?.borderOpacity ?? 1.0)
@@ -562,10 +562,10 @@ Item {
} else { } else {
d = `M ${i + w} ${i + cr}`; d = `M ${i + w} ${i + cr}`;
if (cr > 0) 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}`; d += ` L ${i + cr} ${i}`;
if (cr > 0) 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; return d;
} }
@@ -585,10 +585,10 @@ Item {
} else { } else {
d = `M ${i + w - cr} ${i + h}`; d = `M ${i + w - cr} ${i + h}`;
if (cr > 0) 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}`; d += ` L ${i + w} ${i + cr}`;
if (cr > 0) 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; return d;
} }

View File

@@ -1570,7 +1570,7 @@ Item {
position: newPos position: newPos
}); });
const isVertical = newPos === SettingsData.Position.Left || newPos === SettingsData.Position.Right; const isVertical = newPos === SettingsData.Position.Left || newPos === SettingsData.Position.Right;
if (!wasVertical && !isVertical) { if (wasVertical !== isVertical || !isVertical) {
notifyHorizontalBarChange(); notifyHorizontalBarChange();
} }
} }