mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Introduce setting to configure the font weight in the Workspaces widget
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user