1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-03 20:32:07 -04:00

settings: restore notifyHorizontalBarChanged

This commit is contained in:
bbedward
2026-02-24 19:42:04 -05:00
parent 8bb3ee5f18
commit 05713cb389
2 changed files with 38 additions and 0 deletions

View File

@@ -28,6 +28,35 @@ Item {
return pos === SettingsData.Position.Left || pos === SettingsData.Position.Right;
}
Timer {
id: horizontalBarChangeDebounce
interval: 500
repeat: false
onTriggered: {
const verticalBars = SettingsData.barConfigs.filter(cfg => {
const pos = cfg.position ?? SettingsData.Position.Top;
return pos === SettingsData.Position.Left || pos === SettingsData.Position.Right;
});
verticalBars.forEach(bar => {
if (!bar.enabled)
return;
SettingsData.updateBarConfig(bar.id, {
enabled: false
});
Qt.callLater(() => SettingsData.updateBarConfig(bar.id, {
enabled: true
}));
});
}
}
function notifyHorizontalBarChange() {
if (selectedBarIsVertical)
return;
horizontalBarChangeDebounce.restart();
}
function createNewBar() {
if (SettingsData.barConfigs.length >= 4)
return;
@@ -514,6 +543,9 @@ Item {
SettingsData.updateBarConfig(selectedBarId, {
position: newPos
});
const isVertical = newPos === SettingsData.Position.Left || newPos === SettingsData.Position.Right;
if (wasVertical !== isVertical || !isVertical)
notifyHorizontalBarChange();
}
}
}
@@ -532,6 +564,7 @@ Item {
SettingsData.updateBarConfig(selectedBarId, {
autoHide: toggled
});
notifyHorizontalBarChange();
}
}
@@ -598,6 +631,7 @@ Item {
SettingsData.updateBarConfig(selectedBarId, {
visible: toggled
});
notifyHorizontalBarChange();
}
}

View File

@@ -18,6 +18,8 @@ Singleton {
function registerWidget(widgetId, screenName, widgetRef) {
if (!widgetId || !screenName || !widgetRef)
return;
if (typeof widgetRegistry !== "object" || widgetRegistry === null)
widgetRegistry = ({});
if (!widgetRegistry[widgetId])
widgetRegistry[widgetId] = {};
@@ -29,6 +31,8 @@ Singleton {
function unregisterWidget(widgetId, screenName) {
if (!widgetId || !screenName)
return;
if (typeof widgetRegistry !== "object" || widgetRegistry === null)
return;
if (!widgetRegistry[widgetId])
return;