From 380f31fbd9c4236ac9a72224d145de3ad6d24cab Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Fri, 12 Sep 2025 12:54:09 -0400 Subject: [PATCH] BaBar Widgets: pass a proper section name instead of a longer string. --- Modules/Bar/Bar.qml | 6 +++--- Modules/Bar/Widgets/ActiveWindow.qml | 3 +-- Modules/Bar/Widgets/Battery.qml | 3 +-- Modules/Bar/Widgets/Brightness.qml | 3 +-- Modules/Bar/Widgets/Clock.qml | 3 +-- Modules/Bar/Widgets/CustomButton.qml | 3 +-- Modules/Bar/Widgets/KeyboardLayout.qml | 3 +-- Modules/Bar/Widgets/MediaMini.qml | 3 +-- Modules/Bar/Widgets/Microphone.qml | 3 +-- Modules/Bar/Widgets/NotificationHistory.qml | 3 +-- Modules/Bar/Widgets/SidePanelToggle.qml | 3 +-- Modules/Bar/Widgets/Spacer.qml | 3 +-- Modules/Bar/Widgets/SystemMonitor.qml | 3 +-- Modules/Bar/Widgets/Volume.qml | 3 +-- Modules/Bar/Widgets/Workspace.qml | 3 +-- Services/BarWidgetRegistry.qml | 4 ++-- 16 files changed, 19 insertions(+), 33 deletions(-) diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index dfcb721..ad783af 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -77,7 +77,7 @@ Variants { "screen": root.modelData || null, "scaling": ScalingService.getScreenScale(screen), "widgetId": modelData.id, - "barSection": parent.objectName, + "section": parent.objectName.replace("Section", "").toLowerCase(), "sectionWidgetIndex": index, "sectionWidgetsCount": Settings.data.bar.widgets.left.length } @@ -105,7 +105,7 @@ Variants { "screen": root.modelData || null, "scaling": ScalingService.getScreenScale(screen), "widgetId": modelData.id, - "barSection": parent.objectName, + "section": parent.objectName.replace("Section", "").toLowerCase(), "sectionWidgetIndex": index, "sectionWidgetsCount": Settings.data.bar.widgets.center.length } @@ -134,7 +134,7 @@ Variants { "screen": root.modelData || null, "scaling": ScalingService.getScreenScale(screen), "widgetId": modelData.id, - "barSection": parent.objectName, + "section": parent.objectName.replace("Section", "").toLowerCase(), "sectionWidgetIndex": index, "sectionWidgetsCount": Settings.data.bar.widgets.right.length } diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index a42f982..d3fb762 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -15,13 +15,12 @@ RowLayout { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/Battery.qml b/Modules/Bar/Widgets/Battery.qml index c76722d..a718868 100644 --- a/Modules/Bar/Widgets/Battery.qml +++ b/Modules/Bar/Widgets/Battery.qml @@ -14,13 +14,12 @@ Item { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/Brightness.qml b/Modules/Bar/Widgets/Brightness.qml index 4d8107b..9a81997 100644 --- a/Modules/Bar/Widgets/Brightness.qml +++ b/Modules/Bar/Widgets/Brightness.qml @@ -13,13 +13,12 @@ Item { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/Clock.qml b/Modules/Bar/Widgets/Clock.qml index 2c2c9ed..fd37ce0 100644 --- a/Modules/Bar/Widgets/Clock.qml +++ b/Modules/Bar/Widgets/Clock.qml @@ -13,13 +13,12 @@ Rectangle { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/CustomButton.qml b/Modules/Bar/Widgets/CustomButton.qml index c233ff0..f80f8ba 100644 --- a/Modules/Bar/Widgets/CustomButton.qml +++ b/Modules/Bar/Widgets/CustomButton.qml @@ -15,13 +15,12 @@ NIconButton { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/KeyboardLayout.qml b/Modules/Bar/Widgets/KeyboardLayout.qml index 74ef083..aff5cdc 100644 --- a/Modules/Bar/Widgets/KeyboardLayout.qml +++ b/Modules/Bar/Widgets/KeyboardLayout.qml @@ -15,13 +15,12 @@ Item { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/MediaMini.qml b/Modules/Bar/Widgets/MediaMini.qml index 8d48a85..ae68eff 100644 --- a/Modules/Bar/Widgets/MediaMini.qml +++ b/Modules/Bar/Widgets/MediaMini.qml @@ -15,13 +15,12 @@ RowLayout { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/Microphone.qml b/Modules/Bar/Widgets/Microphone.qml index 24156bb..fe671f9 100644 --- a/Modules/Bar/Widgets/Microphone.qml +++ b/Modules/Bar/Widgets/Microphone.qml @@ -15,13 +15,12 @@ Item { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/NotificationHistory.qml b/Modules/Bar/Widgets/NotificationHistory.qml index aca0da0..3737242 100644 --- a/Modules/Bar/Widgets/NotificationHistory.qml +++ b/Modules/Bar/Widgets/NotificationHistory.qml @@ -15,13 +15,12 @@ NIconButton { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/SidePanelToggle.qml b/Modules/Bar/Widgets/SidePanelToggle.qml index 66eaf01..80855cf 100644 --- a/Modules/Bar/Widgets/SidePanelToggle.qml +++ b/Modules/Bar/Widgets/SidePanelToggle.qml @@ -14,13 +14,12 @@ NIconButton { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/Spacer.qml b/Modules/Bar/Widgets/Spacer.qml index fcb8cfe..8f1378e 100644 --- a/Modules/Bar/Widgets/Spacer.qml +++ b/Modules/Bar/Widgets/Spacer.qml @@ -14,13 +14,12 @@ Item { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/SystemMonitor.qml b/Modules/Bar/Widgets/SystemMonitor.qml index 788b541..9141858 100644 --- a/Modules/Bar/Widgets/SystemMonitor.qml +++ b/Modules/Bar/Widgets/SystemMonitor.qml @@ -13,13 +13,12 @@ RowLayout { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/Volume.qml b/Modules/Bar/Widgets/Volume.qml index c0bf407..7b08046 100644 --- a/Modules/Bar/Widgets/Volume.qml +++ b/Modules/Bar/Widgets/Volume.qml @@ -15,13 +15,12 @@ Item { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Modules/Bar/Widgets/Workspace.qml b/Modules/Bar/Widgets/Workspace.qml index d8bb543..9c216fb 100644 --- a/Modules/Bar/Widgets/Workspace.qml +++ b/Modules/Bar/Widgets/Workspace.qml @@ -16,13 +16,12 @@ Item { // Widget properties passed from Bar.qml for per-instance settings property string widgetId: "" - property string barSection: "" + property string section: "" property int sectionWidgetIndex: -1 property int sectionWidgetsCount: 0 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { - var section = barSection.replace("Section", "").toLowerCase() if (section && sectionWidgetIndex >= 0) { var widgets = Settings.data.bar.widgets[section] if (widgets && sectionWidgetIndex < widgets.length) { diff --git a/Services/BarWidgetRegistry.qml b/Services/BarWidgetRegistry.qml index b67c769..a1a61bc 100644 --- a/Services/BarWidgetRegistry.qml +++ b/Services/BarWidgetRegistry.qml @@ -206,9 +206,9 @@ Singleton { function getNPillDirection(widget) { try { - if (widget.barSection === "leftSection") { + if (widget.section === "left") { return true - } else if (widget.barSection === "rightSection") { + } else if (widget.section === "right") { return false } else { // middle section