Bar editor: removing the last ControlCenter triggers a toast warning.

This commit is contained in:
ItsLemmy
2025-09-25 21:54:51 -04:00
parent 95d059007e
commit 012ae28dd9
2 changed files with 12 additions and 3 deletions
+6 -1
View File
@@ -314,8 +314,13 @@ ColumnLayout {
function _removeWidgetFromSection(section, index) {
if (index >= 0 && index < Settings.data.bar.widgets[section].length) {
var newArray = Settings.data.bar.widgets[section].slice()
newArray.splice(index, 1)
var removedWidgets = newArray.splice(index, 1)
Settings.data.bar.widgets[section] = newArray
// Check that we still have a control center
if (removedWidgets[0].id === "ControlCenter" && BarService.lookupWidget("ControlCenter") === undefined) {
ToastService.showWarning(I18n.tr("toast.missing-control-center.label"), I18n.tr("toast.missing-control-center.description"), 12000)
}
}
}