From 4a3ed282d0adf8c7eddeabb6a03170100e15e71e Mon Sep 17 00:00:00 2001 From: Lemmy Date: Fri, 8 May 2026 21:03:23 -0400 Subject: [PATCH] settings: bar setting re-ordering/polishing and tuning --- assets/translations/en.json | 4 +- src/shell/settings/bar_widget_editor.cpp | 6 +- src/shell/settings/settings_registry.cpp | 68 +++++++++---------- .../settings/widget_settings_registry.cpp | 8 +-- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index ee0c0f7dc..b50660ae1 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -697,8 +697,7 @@ "move-to-lane": "Move to {lane}" }, "detail": { - "custom": "custom widget", - "type": "type: {type}" + "custom": "custom widget" } } }, @@ -723,6 +722,7 @@ "behavior": "Behavior", "brightness": "Brightness", "built-in": "Built-in", + "capsules": "Capsules", "clipboard": "Clipboard", "community": "Community", "control-center": "Control Center:", diff --git a/src/shell/settings/bar_widget_editor.cpp b/src/shell/settings/bar_widget_editor.cpp index 997a8e520..afcfbf5fd 100644 --- a/src/shell/settings/bar_widget_editor.cpp +++ b/src/shell/settings/bar_widget_editor.cpp @@ -1711,8 +1711,10 @@ namespace settings { } item->addChild(std::move(itemTop)); - item->addChild(makeLabel(info.detail, Style::fontSizeCaption * ctx.scale, - colorSpecFromRole(ColorRole::OnSurfaceVariant), false)); + if (info.kind != WidgetReferenceKind::BuiltIn && !info.detail.empty()) { + item->addChild(makeLabel(info.detail, Style::fontSizeCaption * ctx.scale, + colorSpecFromRole(ColorRole::OnSurfaceVariant), false)); + } if (!capsuleGroup.empty()) { auto groupRow = std::make_unique(); groupRow->setDirection(FlexDirection::Horizontal); diff --git a/src/shell/settings/settings_registry.cpp b/src/shell/settings/settings_registry.cpp index 7f19b1c05..75bcbfbc1 100644 --- a/src/shell/settings/settings_registry.cpp +++ b/src/shell/settings/settings_registry.cpp @@ -926,35 +926,35 @@ namespace settings { entries.push_back(makeEntry(section, "effects", tr("settings.schema.shared.contact-shadow.label"), tr("settings.schema.bar.contact-shadow.description"), path("contact_shadow"), ToggleSetting{selectedBar->contactShadow}, "shadow contact panel attached")); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.widget-capsules.label"), - tr("settings.schema.bar.widget-capsules.description"), path("capsule"), - ToggleSetting{selectedBar->widgetCapsuleDefault}, "pill")); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.widget-color.label"), - tr("settings.schema.bar.widget-color.description"), path("color"), - optionalColorRolePicker(selectedBar->widgetColor), "color role foreground", true)); - entries.push_back(makeEntry(section, "grouping", tr("settings.schema.bar.capsule-groups.label"), - tr("settings.schema.bar.capsule-groups.description"), path("capsule_groups"), - ListSetting{.items = selectedBar->widgetCapsuleGroups}, "grouped capsules")); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-fill.label"), - tr("settings.schema.bar.capsule-fill.description"), path("capsule_fill"), - colorRolePicker(selectedBar->widgetCapsuleFill), "color role pill", true)); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-foreground.label"), - tr("settings.schema.bar.capsule-foreground.description"), path("capsule_foreground"), - optionalColorRolePicker(selectedBar->widgetCapsuleForeground), - "color role foreground pill", true)); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-border.label"), - tr("settings.schema.bar.capsule-border.description"), path("capsule_border"), - capsuleBorderRolePicker(selectedBar->widgetCapsuleBorder), "color role pill outline", - true)); entries.push_back( makeEntry(section, "widgets", tr("settings.schema.bar.widget-spacing.label"), tr("settings.schema.bar.widget-spacing.description"), path("widget_spacing"), SliderSetting{static_cast(selectedBar->widgetSpacing), 0.0f, 32.0f, 1.0f, true}, "gap")); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-padding.label"), + entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.widget-color.label"), + tr("settings.schema.bar.widget-color.description"), path("color"), + optionalColorRolePicker(selectedBar->widgetColor), "color role foreground", true)); + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.widget-capsules.label"), + tr("settings.schema.bar.widget-capsules.description"), path("capsule"), + ToggleSetting{selectedBar->widgetCapsuleDefault}, "pill")); + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.capsule-groups.label"), + tr("settings.schema.bar.capsule-groups.description"), path("capsule_groups"), + ListSetting{.items = selectedBar->widgetCapsuleGroups}, "grouped capsules")); + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.capsule-fill.label"), + tr("settings.schema.bar.capsule-fill.description"), path("capsule_fill"), + colorRolePicker(selectedBar->widgetCapsuleFill), "color role pill", true)); + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.capsule-foreground.label"), + tr("settings.schema.bar.capsule-foreground.description"), path("capsule_foreground"), + optionalColorRolePicker(selectedBar->widgetCapsuleForeground), + "color role foreground pill", true)); + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.capsule-border.label"), + tr("settings.schema.bar.capsule-border.description"), path("capsule_border"), + capsuleBorderRolePicker(selectedBar->widgetCapsuleBorder), "color role pill outline", + true)); + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.capsule-padding.label"), tr("settings.schema.bar.capsule-padding.description"), path("capsule_padding"), SliderSetting{selectedBar->widgetCapsulePadding, 0.0f, 48.0f, 1.0f, false}, "pill inset", true)); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-opacity.label"), + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.capsule-opacity.label"), tr("settings.schema.bar.capsule-opacity.description"), path("capsule_opacity"), SliderSetting{selectedBar->widgetCapsuleOpacity, 0.0f, 1.0f, 0.01f, false}, "pill alpha", true)); @@ -1057,41 +1057,41 @@ namespace settings { tr("settings.schema.bar.widget-spacing.description"), mpath("widget_spacing"), SliderSetting{static_cast(ovr.widgetSpacing.value_or(bar.widgetSpacing)), 0.0f, 32.0f, 1.0f, true}, "gap")); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.widget-capsules.label"), - tr("settings.schema.bar.widget-capsules.description"), mpath("capsule"), - ToggleSetting{ovr.widgetCapsuleDefault.value_or(bar.widgetCapsuleDefault)}, "pill")); entries.push_back( makeEntry(section, "widgets", tr("settings.schema.bar.widget-color.label"), tr("settings.schema.bar.widget-color.description"), mpath("color"), optionalColorRolePicker(ovr.widgetColor.has_value() ? ovr.widgetColor : bar.widgetColor), "color role foreground", true)); - entries.push_back(makeEntry(section, "widgets", tr("settings.schema.bar.capsule-fill.label"), + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.widget-capsules.label"), + tr("settings.schema.bar.widget-capsules.description"), mpath("capsule"), + ToggleSetting{ovr.widgetCapsuleDefault.value_or(bar.widgetCapsuleDefault)}, "pill")); + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.capsule-groups.label"), + tr("settings.schema.bar.capsule-groups.description"), mpath("capsule_groups"), + ListSetting{.items = ovr.widgetCapsuleGroups.value_or(bar.widgetCapsuleGroups)}, + "grouped capsules")); + entries.push_back(makeEntry(section, "capsules", tr("settings.schema.bar.capsule-fill.label"), tr("settings.schema.bar.capsule-fill.description"), mpath("capsule_fill"), colorRolePicker(ovr.widgetCapsuleFill.value_or(bar.widgetCapsuleFill)), "color role pill", true)); entries.push_back( - makeEntry(section, "widgets", tr("settings.schema.bar.capsule-foreground.label"), + makeEntry(section, "capsules", tr("settings.schema.bar.capsule-foreground.label"), tr("settings.schema.bar.capsule-foreground.description"), mpath("capsule_foreground"), optionalColorRolePicker(ovr.widgetCapsuleForeground.has_value() ? ovr.widgetCapsuleForeground : bar.widgetCapsuleForeground), "color role foreground pill", true)); entries.push_back(makeEntry( - section, "widgets", tr("settings.schema.bar.capsule-border.label"), + section, "capsules", tr("settings.schema.bar.capsule-border.label"), tr("settings.schema.bar.capsule-border.description"), mpath("capsule_border"), capsuleBorderRolePicker(ovr.widgetCapsuleBorderSpecified ? ovr.widgetCapsuleBorder : bar.widgetCapsuleBorder), "color role pill outline", true)); - entries.push_back(makeEntry(section, "grouping", tr("settings.schema.bar.capsule-groups.label"), - tr("settings.schema.bar.capsule-groups.description"), mpath("capsule_groups"), - ListSetting{.items = ovr.widgetCapsuleGroups.value_or(bar.widgetCapsuleGroups)}, - "grouped capsules")); entries.push_back( - makeEntry(section, "widgets", tr("settings.schema.bar.capsule-padding.label"), + makeEntry(section, "capsules", tr("settings.schema.bar.capsule-padding.label"), tr("settings.schema.bar.capsule-padding.description"), mpath("capsule_padding"), SliderSetting{static_cast(ovr.widgetCapsulePadding.value_or(bar.widgetCapsulePadding)), 0.0f, 48.0f, 1.0f, false}, "pill inset", true)); entries.push_back( - makeEntry(section, "widgets", tr("settings.schema.bar.capsule-opacity.label"), + makeEntry(section, "capsules", tr("settings.schema.bar.capsule-opacity.label"), tr("settings.schema.bar.capsule-opacity.description"), mpath("capsule_opacity"), SliderSetting{static_cast(ovr.widgetCapsuleOpacity.value_or(bar.widgetCapsuleOpacity)), 0.0f, 1.0f, 0.01f, false}, diff --git a/src/shell/settings/widget_settings_registry.cpp b/src/shell/settings/widget_settings_registry.cpp index 120435569..7feb96ab7 100644 --- a/src/shell/settings/widget_settings_registry.cpp +++ b/src/shell/settings/widget_settings_registry.cpp @@ -324,7 +324,7 @@ namespace settings { it != cfg.widgets.end() && !it->second.type.empty() && it->second.type != name) { return WidgetReferenceInfo{ .title = std::string(name), - .detail = tr("settings.entities.widget.detail.type", "type", it->second.type), + .detail = it->second.type, .badge = tr("settings.entities.widget.kinds.named"), .kind = WidgetReferenceKind::Named, }; @@ -340,8 +340,7 @@ namespace settings { if (const auto it = cfg.widgets.find(std::string(name)); it != cfg.widgets.end()) { return WidgetReferenceInfo{ .title = widgetInstanceDisplayLabel(name), - .detail = it->second.type.empty() ? tr("settings.entities.widget.detail.custom") - : tr("settings.entities.widget.detail.type", "type", it->second.type), + .detail = it->second.type.empty() ? tr("settings.entities.widget.detail.custom") : it->second.type, .badge = tr("settings.entities.widget.kinds.named"), .kind = WidgetReferenceKind::Named, }; @@ -372,8 +371,7 @@ namespace settings { continue; } addPickerEntry(entries, seen, name, widgetInstanceDisplayLabel(name), - widget.type.empty() ? tr("settings.entities.widget.detail.custom") - : tr("settings.entities.widget.detail.type", "type", widget.type), + widget.type.empty() ? tr("settings.entities.widget.detail.custom") : widget.type, tr("settings.entities.widget.kinds.named"), WidgetReferenceKind::Named); }