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:
@@ -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: {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user