NSectionEditor/ControlCenter: Allow up to 10 widgets if using a single side.

This commit is contained in:
ItsLemmy
2025-11-27 09:00:19 -05:00
parent fd17032fe5
commit 2fe915e3bc
3 changed files with 5 additions and 6 deletions

View File

@@ -249,7 +249,7 @@ ColumnLayout {
sectionName: I18n.tr("settings.control-center.shortcuts.sectionLeft")
sectionId: "left"
settingsDialogComponent: Qt.resolvedUrl(Quickshell.shellDir + "/Modules/Panels/Settings/ControlCenter/ControlCenterWidgetSettingsDialog.qml")
maxWidgets: 5
maxWidgets: Settings.data.controlCenter.shortcuts["right"].length > 5 ? 0 : (Settings.data.controlCenter.shortcuts["right"].length > 0 ? 5 : 10)
widgetRegistry: ControlCenterWidgetRegistry
widgetModel: Settings.data.controlCenter.shortcuts["left"]
availableWidgets: availableWidgets
@@ -266,7 +266,7 @@ ColumnLayout {
sectionName: I18n.tr("settings.control-center.shortcuts.sectionRight")
sectionId: "right"
settingsDialogComponent: Qt.resolvedUrl(Quickshell.shellDir + "/Modules/Panels/Settings/ControlCenter/ControlCenterWidgetSettingsDialog.qml")
maxWidgets: 5
maxWidgets: Settings.data.controlCenter.shortcuts["left"].length > 5 ? 0 : (Settings.data.controlCenter.shortcuts["left"].length > 0 ? 5 : 10)
widgetRegistry: ControlCenterWidgetRegistry
widgetModel: Settings.data.controlCenter.shortcuts["right"]
availableWidgets: availableWidgets

View File

@@ -153,7 +153,6 @@ Item {
} else {
Logger.e("NiriService", "Niri returned an error:", data.Err, line);
}
} catch (e) {
Logger.e("NiriService", "Failed to parse data from socket:", e, line);
return;

View File

@@ -19,7 +19,7 @@ NBox {
property string settingsDialogComponent: "BarWidgetSettingsDialog.qml"
readonly property real miniButtonSize: Style.baseWidgetSize * 0.65
readonly property bool isAtMaxCapacity: maxWidgets > 0 && widgetModel.length >= maxWidgets
readonly property bool isAtMaxCapacity: maxWidgets >= 0 && widgetModel.length >= maxWidgets
signal addWidget(string widgetId, string section)
signal removeWidget(string section, int index)
@@ -93,8 +93,8 @@ NBox {
// Widget count indicator (when max is set)
NText {
visible: root.maxWidgets > 0
text: "(" + widgetModel.length + "/" + root.maxWidgets + ")"
visible: root.maxWidgets >= 0
text: root.maxWidgets === 0 ? "(LOCKED)" : "(" + widgetModel.length + "/" + root.maxWidgets + ")"
pointSize: Style.fontSizeS
color: root.isAtMaxCapacity ? Color.mError : Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignVCenter