Introduce setting to configure the font weight in the Workspaces widget

This commit is contained in:
Mark Vincze
2026-03-07 00:48:33 +01:00
parent c77497f8aa
commit af76e6a442
6 changed files with 63 additions and 5 deletions
+7
View File
@@ -303,6 +303,8 @@
"occupied-color-label": "Occupied workspace color",
"pill-size-description": "Adjust the size of workspace pills.",
"pill-size-label": "Pill size",
"font-weight-description": "Set the visual weight for text within workspace.",
"font-weight-label": "Font weight",
"reverse-scrolling-description": "Reverse the direction of workspace switching when scrolling.",
"reverse-scrolling-label": "Reverse scrolling",
"show-applications-description": "Display application icons inside each workspace.",
@@ -426,6 +428,11 @@
"execute": "Execute",
"faithful": "Faithful",
"focus": "Focus",
"font-weight-light": "Light",
"font-weight-regular": "Regular",
"font-weight-medium": "Medium",
"font-weight-semibold": "Semi-bold",
"font-weight-bold": "Bold",
"frequency": "Frequency",
"gateway": "Gateway",
"general": "General",
+3 -2
View File
@@ -225,7 +225,8 @@
"occupiedColor": "secondary",
"emptyColor": "secondary",
"showBadge": true,
"pillSize": 0.6
"pillSize": 0.6,
"fontWeight": "bold"
},
"Volume": {
"displayMode": "onhover",
@@ -280,4 +281,4 @@
"layout": "bottom"
}
}
}
}
+2 -1
View File
@@ -14,6 +14,7 @@ Item {
required property real capsuleHeight
required property real barHeight
required property string labelMode
required property int fontWeight
required property int characterCount
required property real textRatio
required property bool showLabelsOnlyWhenOccupied
@@ -119,7 +120,7 @@ Item {
pointSize: (isVertical ? pillContainer.pillWidth : pillContainer.pillHeight) * textRatio
applyUiScale: false
font.capitalization: Font.AllUppercase
font.weight: Style.fontWeightBold
font.weight: fontWeight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
+17 -1
View File
@@ -44,6 +44,20 @@ Item {
readonly property string labelMode: (widgetSettings.labelMode !== undefined) ? widgetSettings.labelMode : widgetMetadata.labelMode
readonly property bool hasLabel: (labelMode !== "none")
readonly property string fontWeight: {
var fontWeightSetting = (widgetSettings.fontWeight !== undefined) ?
widgetSettings.fontWeight : widgetMetadata.fontWeight;
if (fontWeightSetting === "regular")
return Style.fontWeightRegular;
if (fontWeightSetting === "medium")
return Style.fontWeightMedium;
if (fontWeightSetting === "semibold")
return Style.fontWeightSemiBold;
if (fontWeightSetting === "bold")
return Style.fontWeightBold;
return Style.fontWeightBold;
}
readonly property bool hideUnoccupied: (widgetSettings.hideUnoccupied !== undefined) ? widgetSettings.hideUnoccupied : widgetMetadata.hideUnoccupied
readonly property bool followFocusedScreen: (widgetSettings.followFocusedScreen !== undefined) ? widgetSettings.followFocusedScreen : widgetMetadata.followFocusedScreen
readonly property int characterCount: isVertical ? 2 : ((widgetSettings.characterCount !== undefined) ? widgetSettings.characterCount : widgetMetadata.characterCount)
@@ -555,6 +569,7 @@ Item {
capsuleHeight: root.capsuleHeight
barHeight: root.barHeight
labelMode: root.labelMode
fontWeight: root.fontWeight
characterCount: root.characterCount
textRatio: root.textRatio
showLabelsOnlyWhenOccupied: root.showLabelsOnlyWhenOccupied
@@ -589,6 +604,7 @@ Item {
capsuleHeight: root.capsuleHeight
barHeight: root.barHeight
labelMode: root.labelMode
fontWeight: root.fontWeight
characterCount: root.characterCount
textRatio: root.textRatio
showLabelsOnlyWhenOccupied: root.showLabelsOnlyWhenOccupied
@@ -853,7 +869,7 @@ Item {
family: Settings.data.ui.fontFixed
font {
pointSize: barFontSize * 0.75
weight: Style.fontWeightBold
weight: fontWeight
capitalization: Font.AllUppercase
}
applyUiScale: false
@@ -33,6 +33,7 @@ ColumnLayout {
property string valueEmptyColor: widgetData.emptyColor !== undefined ? widgetData.emptyColor : widgetMetadata.emptyColor
property bool valueShowBadge: widgetData.showBadge !== undefined ? widgetData.showBadge : widgetMetadata.showBadge
property real valuePillSize: widgetData.pillSize !== undefined ? widgetData.pillSize : widgetMetadata.pillSize
property string valueFontWeight: widgetData.fontWeight !== undefined ? widgetData.fontWeight : widgetMetadata.fontWeight
function saveSettings() {
var settings = Object.assign({}, widgetData || {});
@@ -52,6 +53,7 @@ ColumnLayout {
settings.emptyColor = valueEmptyColor;
settings.showBadge = valueShowBadge;
settings.pillSize = valuePillSize;
settings.fontWeight = valueFontWeight;
settingsChanged(settings);
}
@@ -115,6 +117,36 @@ ColumnLayout {
visible: !valueShowApplications
}
NComboBox {
id: fontWeightCombo
label: I18n.tr("bar.workspace.font-weight-label")
description: I18n.tr("bar.workspace.font-weight-description")
model: [
{
"key": "regular",
"name": I18n.tr("common.font-weight-regular")
},
{
"key": "medium",
"name": I18n.tr("common.font-weight-medium")
},
{
"key": "semibold",
"name": I18n.tr("common.font-weight-semibold")
},
{
"key": "bold",
"name": I18n.tr("common.font-weight-bold")
},
]
currentKey: widgetData.fontWeight || widgetMetadata.fontWeight
onSelected: key => {
valueFontWeight = key;
saveSettings();
}
minimumWidth: 200
}
NToggle {
label: I18n.tr("bar.workspace.hide-unoccupied-label")
description: I18n.tr("bar.workspace.hide-unoccupied-description")
+2 -1
View File
@@ -303,7 +303,8 @@ Singleton {
"occupiedColor": "secondary",
"emptyColor": "secondary",
"showBadge": true,
"pillSize": 0.6
"pillSize": 0.6,
"fontWeight": "bold"
},
"Volume": {
"displayMode": "onhover",