Bar: Using Style.barFontSize everywhere to fix bar's text discrepancies as much as possible. Also removing most fontWeight discrepancies. Only keeping bold for workspace numbers/names.

This commit is contained in:
Lemmy
2026-01-02 01:12:50 -05:00
parent 8752f720f6
commit 851c43142b
12 changed files with 56 additions and 110 deletions
+11 -3
View File
@@ -85,7 +85,7 @@ Singleton {
readonly property real uiScaleRatio: Settings.data.general.scaleRatio
// Bar Dimensions
// Bar Height
readonly property real barHeight: {
let h;
switch (Settings.data.bar.density) {
@@ -105,9 +105,10 @@ Singleton {
case "default":
h = (Settings.data.bar.position === "left" || Settings.data.bar.position === "right") ? 33 : 31;
}
return h;
//return toOdd(h);
return toOdd(h);
}
// Capsule Height -
readonly property real capsuleHeight: {
let h;
switch (Settings.data.bar.density) {
@@ -129,6 +130,13 @@ Singleton {
}
return toOdd(h);
}
readonly property real barScaling: (Settings.data.bar.density === "mini" || Settings.data.bar.density === "compact") ? 0.9 : 1.0
// The base/default font size for all text in the bar. 33 is the "default" barHeight
readonly property real _barBaseFontSize: (Style.barHeight / 33) * Style.barScaling * Style.fontSizeM
readonly property real barFontSize: (Settings.data.bar.position === "left" || Settings.data.bar.position === "right") ? _barBaseFontSize * 0.9 : _barBaseFontSize
readonly property color capsuleColor: Settings.data.bar.showCapsule ? Qt.alpha(Color.mSurfaceVariant, Settings.data.bar.capsuleOpacity) : Color.transparent
readonly property color capsuleBorderColor: Settings.data.bar.showOutline ? Color.mPrimary : Color.transparent
-6
View File
@@ -223,7 +223,6 @@ Item {
required property int index
widgetId: modelData.id || ""
barDensity: Settings.data.bar.density
widgetScreen: root.screen
widgetProps: ({
"widgetId": modelData.id,
@@ -249,7 +248,6 @@ Item {
required property int index
widgetId: modelData.id || ""
barDensity: Settings.data.bar.density
widgetScreen: root.screen
widgetProps: ({
"widgetId": modelData.id,
@@ -276,7 +274,6 @@ Item {
required property int index
widgetId: modelData.id || ""
barDensity: Settings.data.bar.density
widgetScreen: root.screen
widgetProps: ({
"widgetId": modelData.id,
@@ -314,7 +311,6 @@ Item {
required property int index
widgetId: modelData.id || ""
barDensity: Settings.data.bar.density
widgetScreen: root.screen
widgetProps: ({
"widgetId": modelData.id,
@@ -342,7 +338,6 @@ Item {
required property int index
widgetId: modelData.id || ""
barDensity: Settings.data.bar.density
widgetScreen: root.screen
widgetProps: ({
"widgetId": modelData.id,
@@ -371,7 +366,6 @@ Item {
required property int index
widgetId: modelData.id || ""
barDensity: Settings.data.bar.density
widgetScreen: root.screen
widgetProps: ({
"widgetId": modelData.id,
+1 -11
View File
@@ -60,15 +60,6 @@ Item {
}
}
readonly property real textSize: {
switch (root.density) {
case "compact":
return Math.max(1, Math.round(pillHeight * 0.45));
default:
return Math.max(1, Math.round(pillHeight * 0.33));
}
}
width: {
if (collapseToIcon) {
return hasIcon ? pillHeight : 0;
@@ -146,9 +137,8 @@ Item {
}
text: root.text + root.suffix
family: Settings.data.ui.fontFixed
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightBold
color: root.fgColor
visible: revealed
}
+1 -11
View File
@@ -67,15 +67,6 @@ Item {
}
}
readonly property real textSize: {
switch (root.density) {
case "compact":
return Math.max(1, Math.round(pillHeight * 0.38));
default:
return Math.max(1, Math.round(pillHeight * 0.33));
}
}
// For vertical bars: width is just icon size, height includes pill space
width: buttonSize
height: {
@@ -154,9 +145,8 @@ Item {
rotation: rotateText ? -90 : 0
text: root.text + root.suffix
family: Settings.data.ui.fontFixed
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: root.fgColor
-10
View File
@@ -11,9 +11,6 @@ Item {
required property var widgetScreen
required property var widgetProps
property string barDensity: "default"
readonly property real barScaling: barDensity === "mini" ? 0.8 : (barDensity === "compact" ? 0.9 : 1.0)
// Extract section info from widgetProps
readonly property string section: widgetProps ? (widgetProps.section || "") : ""
readonly property int sectionIndex: widgetProps ? (widgetProps.sectionWidgetIndex || 0) : 0
@@ -81,13 +78,6 @@ Item {
item.screen = widgetScreen;
}
// Set bar scaling property
if (item.hasOwnProperty("barScaling")) {
item.barScaling = Qt.binding(function () {
return root.barScaling;
});
}
// Inject plugin API for plugin widgets
// The API is fully populated (settings/translations already loaded) by PluginService
if (BarWidgetRegistry.isPluginWidget(widgetId)) {
+10 -14
View File
@@ -20,7 +20,6 @@ Item {
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property real barScaling: 1.0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] || {}
property var widgetSettings: {
@@ -47,9 +46,8 @@ Item {
readonly property string windowTitle: CompositorService.getFocusedWindowTitle() || "No active window"
readonly property string fallbackIcon: "user-desktop"
readonly property int iconSize: Style.toOdd(Style.capsuleHeight * 0.75 * barScaling)
readonly property int verticalSize: Style.toOdd(Style.capsuleHeight * 0.85 * barScaling)
readonly property int textSize: Math.round(Style.capsuleHeight * 0.4 * barScaling)
readonly property int iconSize: Style.toOdd(Style.capsuleHeight * 0.75 * Style.barScaling)
readonly property int verticalSize: Style.toOdd(Style.capsuleHeight * 0.85 * Style.barScaling)
implicitHeight: visible ? (isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : Style.capsuleHeight) : 0
implicitWidth: visible ? (isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : dynamicWidth)) : 0
@@ -81,12 +79,12 @@ Item {
function calculateContentWidth() {
// Calculate the actual content width based on visible elements
var contentWidth = 0;
var margins = Style.marginS * barScaling * 2; // Left and right margins
var margins = Style.marginS * Style.barScaling * 2; // Left and right margins
// Icon width (if visible)
if (showIcon) {
contentWidth += iconSize;
contentWidth += Style.marginS * barScaling; // Spacing after icon
contentWidth += Style.marginS * Style.barScaling; // Spacing after icon
}
// Text width (use the measured width)
@@ -163,9 +161,8 @@ Item {
id: fullTitleMetrics
visible: false
text: windowTitle
pointSize: root.textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
}
NPopupContextMenu {
@@ -214,14 +211,14 @@ Item {
Item {
id: mainContainer
anchors.fill: parent
anchors.leftMargin: isVerticalBar ? 0 : Style.marginS * barScaling
anchors.rightMargin: isVerticalBar ? 0 : Style.marginS * barScaling
anchors.leftMargin: isVerticalBar ? 0 : Style.marginS * Style.barScaling
anchors.rightMargin: isVerticalBar ? 0 : Style.marginS * Style.barScaling
// Horizontal layout for top/bottom bars
RowLayout {
id: rowLayout
y: Style.pixelAlignCenter(parent.height, height)
spacing: Style.marginS * barScaling
spacing: Style.marginS * Style.barScaling
visible: !isVerticalBar
z: 1
@@ -343,9 +340,8 @@ Item {
NText {
id: titleText
text: windowTitle
pointSize: root.textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
verticalAlignment: Text.AlignVCenter
color: Color.mOnSurface
onTextChanged: {
@@ -362,7 +358,7 @@ Item {
NText {
text: windowTitle
font: titleText.font
pointSize: Style.fontSizeS * barScaling
pointSize: Style.barFontSize
applyUiScale: false
verticalAlignment: Text.AlignVCenter
color: Color.mOnSurface
+3 -7
View File
@@ -17,7 +17,6 @@ Rectangle {
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property real barScaling: 1.0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: {
@@ -75,14 +74,13 @@ Rectangle {
Binding on pointSize {
value: {
if (repeater.model.length == 1) {
return Style.capsuleHeight * 0.4 * barScaling;
return Style.barFontSize;
} else {
return (index == 0) ? Style.capsuleHeight * 0.35 * barScaling : Style.capsuleHeight * 0.3 * barScaling;
return (index == 0) ? Style.barFontSize * 0.9 : Style.barFontSize * 0.75;
}
}
}
applyUiScale: false
font.weight: Style.fontWeightSemiBold
color: usePrimaryColor ? Color.mPrimary : Color.mOnSurface
wrapMode: Text.WordWrap
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
@@ -106,11 +104,9 @@ Rectangle {
text: modelData
family: useCustomFont && customFont ? customFont : Settings.data.ui.fontDefault
Binding on pointSize {
value: Style.fontSizeS * barScaling
value: Style.barFontSize
}
applyUiScale: false
font.weight: Style.fontWeightBold
color: usePrimaryColor ? Color.mPrimary : Color.mOnSurface
wrapMode: Text.WordWrap
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
+15 -20
View File
@@ -17,7 +17,6 @@ Item {
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property real barScaling: 1.0
// Settings
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
@@ -47,10 +46,9 @@ Item {
readonly property real maxWidth: (widgetSettings.maxWidth !== undefined) ? widgetSettings.maxWidth : Math.max(widgetMetadata.maxWidth, screen ? screen.width * 0.06 : 0)
// Dimensions
readonly property int artSize: Style.toOdd(Style.capsuleHeight * 0.75 * barScaling)
readonly property int iconSize: Style.toOdd(Style.capsuleHeight * 0.75 * barScaling)
readonly property int verticalSize: Style.toOdd(Style.capsuleHeight * 0.85 * barScaling)
readonly property int textSize: Math.round(Style.capsuleHeight * 0.4 * barScaling)
readonly property int artSize: Style.toOdd(Style.capsuleHeight * 0.75 * Style.barScaling)
readonly property int iconSize: Style.toOdd(Style.capsuleHeight * 0.75 * Style.barScaling)
readonly property int verticalSize: Style.toOdd(Style.capsuleHeight * 0.85 * Style.barScaling)
// State
readonly property bool hasPlayer: MediaService.currentPlayer !== null
@@ -116,10 +114,10 @@ Item {
// Add spacing and text width
var textWidth = 0;
if (titleMetrics.contentWidth > 0) {
textWidth = Style.marginS * barScaling + titleMetrics.contentWidth + Style.marginXXS * 2;
textWidth = Style.marginS * Style.barScaling + titleMetrics.contentWidth + Style.marginXXS * 2;
}
var margins = isVertical ? 0 : (Style.marginS * barScaling * 2);
var margins = isVertical ? 0 : (Style.marginS * Style.barScaling * 2);
var total = iconWidth + textWidth + margins;
return hasPlayer ? Math.min(total, maxWidth) : total;
}
@@ -149,8 +147,7 @@ Item {
visible: false
text: title
applyUiScale: false
pointSize: root.textSize
font.weight: Style.fontWeightMedium
pointSize: Style.barFontSize
}
// Context menu
@@ -231,8 +228,8 @@ Item {
Item {
anchors.fill: parent
anchors.leftMargin: isVertical ? 0 : Style.marginS * barScaling
anchors.rightMargin: isVertical ? 0 : Style.marginS * barScaling
anchors.leftMargin: isVertical ? 0 : Style.marginS * Style.barScaling
anchors.rightMargin: isVertical ? 0 : Style.marginS * Style.barScaling
clip: true
// Visualizer
@@ -260,7 +257,7 @@ Item {
RowLayout {
anchors.fill: parent
anchors.verticalCenter: parent.verticalCenter
spacing: Style.marginS * barScaling
spacing: Style.marginS * Style.barScaling
visible: !isVertical
z: 1
@@ -287,17 +284,17 @@ Item {
anchors.fill: parent
visible: showProgressRing
progress: MediaService.trackLength > 0 ? MediaService.currentPosition / MediaService.trackLength : 0
lineWidth: 2 * barScaling
lineWidth: 2 * Style.barScaling
}
Item {
anchors.fill: parent
anchors.margins: showProgressRing ? (3 * barScaling) : 0.5
anchors.margins: showProgressRing ? (3 * Style.barScaling) : 0.5
NImageRounded {
visible: showAlbumArt && hasPlayer
anchors.fill: parent
anchors.margins: showProgressRing ? 0 : -1 * barScaling
anchors.margins: showProgressRing ? 0 : -1 * Style.barScaling
radius: width / 2
imagePath: MediaService.trackArtUrl
fallbackIcon: MediaService.isPlaying ? "media-pause" : "media-play"
@@ -311,7 +308,7 @@ Item {
y: Style.pixelAlignCenter(parent.height, contentHeight)
icon: MediaService.isPlaying ? "media-pause" : "media-play"
color: Color.mOnSurface
pointSize: 8 * barScaling
pointSize: Style.barFontSize
}
}
}
@@ -327,7 +324,7 @@ Item {
anchors.fill: parent
text: title
textColor: hasPlayer ? Color.mOnSurface : Color.mOnSurfaceVariant
fontSize: root.textSize
fontSize: Style.barFontSize
scrollMode: scrollingMode
needsScroll: titleMetrics.contentWidth > parent.width
}
@@ -348,7 +345,7 @@ Item {
anchors.fill: parent
visible: showProgressRing
progress: MediaService.trackLength > 0 ? MediaService.currentPosition / MediaService.trackLength : 0
lineWidth: Style.toOdd(2 * barScaling)
lineWidth: Style.toOdd(2 * Style.barScaling)
}
NImageRounded {
@@ -560,7 +557,6 @@ Item {
color: textColor
pointSize: fontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
onTextChanged: {
scrollText.isScrolling = false;
scrollText.isResetting = false;
@@ -574,7 +570,6 @@ Item {
color: textColor
pointSize: fontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
visible: scrollText.needsScroll && scrollText.isScrolling
}
}
+2 -3
View File
@@ -18,7 +18,6 @@ NIconButton {
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property real barScaling: 1.0
icon: ScreenRecorderService.isPending ? "" : "camera-video"
tooltipText: ScreenRecorderService.isRecording ? I18n.tr("tooltips.click-to-stop-recording") : I18n.tr("tooltips.click-to-start-recording")
@@ -55,8 +54,8 @@ NIconButton {
id: pendingSpinner
icon: "loader-2"
visible: ScreenRecorderService.isPending
pointSize: Math.max(1, Style.toOdd(root.width * root.barScaling * 0.65))
applyUiScale: root.applyUiScale
pointSize: Style.barFontSize
applyUiScale: false
color: root.enabled && root.hovering ? colorFgHover : colorFg
anchors.centerIn: parent
transformOrigin: Item.Center
+9 -19
View File
@@ -20,7 +20,6 @@ Rectangle {
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property real barScaling: 1.0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: {
@@ -52,9 +51,8 @@ Rectangle {
readonly property string diskPath: (widgetSettings.diskPath !== undefined) ? widgetSettings.diskPath : widgetMetadata.diskPath
readonly property string fontFamily: useMonospaceFont ? Settings.data.ui.fontFixed : Settings.data.ui.fontDefault
readonly property real iconSize: Style.toOdd(Style.capsuleHeight * root.barScaling * (root.barCompact ? 0.55 : 0.45))
readonly property real iconSize: Style.toOdd(Style.capsuleHeight * Style.barScaling * (root.barCompact ? 0.55 : 0.45))
readonly property real miniGaugeWidth: Math.max(3, Style.toOdd(root.iconSize * 0.25))
readonly property real textSize: Math.max(7, iconSize * barScaling * 0.75 * (isVertical ? 0.85 : 1.0))
function openExternalMonitor() {
Quickshell.execDetached(["sh", "-c", Settings.data.systemMonitor.externalMonitor]);
@@ -283,9 +281,8 @@ Rectangle {
}
}
family: fontFamily
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -353,9 +350,8 @@ Rectangle {
visible: !compactMode
text: `${Math.round(SystemStatService.cpuTemp)}°`
family: fontFamily
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -423,9 +419,8 @@ Rectangle {
visible: !compactMode
text: `${Math.round(SystemStatService.gpuTemp)}°`
family: fontFamily
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -493,9 +488,8 @@ Rectangle {
visible: !compactMode
text: SystemStatService.loadAvg1.toFixed(1)
family: fontFamily
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -563,9 +557,8 @@ Rectangle {
visible: !compactMode
text: showMemoryAsPercent ? `${Math.round(SystemStatService.memPercent)}%` : SystemStatService.formatMemoryGb(SystemStatService.memGb)
family: fontFamily
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -631,9 +624,8 @@ Rectangle {
visible: !compactMode
text: isVertical ? SystemStatService.formatCompactSpeed(SystemStatService.rxSpeed) : SystemStatService.formatSpeed(SystemStatService.rxSpeed)
family: fontFamily
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -698,9 +690,8 @@ Rectangle {
visible: !compactMode
text: isVertical ? SystemStatService.formatCompactSpeed(SystemStatService.txSpeed) : SystemStatService.formatSpeed(SystemStatService.txSpeed)
family: fontFamily
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -767,9 +758,8 @@ Rectangle {
visible: !compactMode
text: SystemStatService.diskPercents[diskPath] ? `${SystemStatService.diskPercents[diskPath]}%` : "n/a"
family: fontFamily
pointSize: textSize
pointSize: Style.barFontSize
applyUiScale: false
font.weight: Style.fontWeightMedium
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
+2 -3
View File
@@ -19,7 +19,6 @@ Rectangle {
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property real barScaling: 1.0
readonly property string barPosition: Settings.data.bar.position
readonly property bool isVerticalBar: barPosition === "left" || barPosition === "right"
@@ -44,7 +43,7 @@ Rectangle {
readonly property bool smartWidth: (widgetSettings.smartWidth !== undefined) ? widgetSettings.smartWidth : widgetMetadata.smartWidth
readonly property int maxTaskbarWidthPercent: (widgetSettings.maxTaskbarWidth !== undefined) ? widgetSettings.maxTaskbarWidth : widgetMetadata.maxTaskbarWidth
readonly property real iconScale: (widgetSettings.iconScale !== undefined) ? widgetSettings.iconScale : widgetMetadata.iconScale
readonly property int itemSize: Style.toOdd(Style.capsuleHeight * barScaling * Math.max(0.1, iconScale))
readonly property int itemSize: Style.toOdd(Style.capsuleHeight * Style.barScaling * Math.max(0.1, iconScale))
// Maximum width for the taskbar widget to prevent overlapping with other widgets
readonly property real maxTaskbarWidth: {
@@ -567,7 +566,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
pointSize: root.itemSize * 0.5
pointSize: Style.barFontSize
color: titleFgColor
opacity: Style.opacityFull
}
+2 -3
View File
@@ -22,7 +22,6 @@ Item {
property string section: ""
property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0
property real barScaling: 1.0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: {
@@ -37,7 +36,7 @@ Item {
readonly property string barPosition: Settings.data.bar.position
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
readonly property real baseDimensionRatio: root.barScaling * 0.65 * (widgetSettings.labelMode === "none" ? 0.75 : 1)
readonly property real baseDimensionRatio: Style.barScaling * 0.65 * (widgetSettings.labelMode === "none" ? 0.75 : 1)
readonly property string labelMode: (widgetSettings.labelMode !== undefined) ? widgetSettings.labelMode : widgetMetadata.labelMode
readonly property bool hideUnoccupied: (widgetSettings.hideUnoccupied !== undefined) ? widgetSettings.hideUnoccupied : widgetMetadata.hideUnoccupied
@@ -983,7 +982,7 @@ Item {
family: Settings.data.ui.fontFixed
font {
pointSize: Style.fontSizeXXS
pointSize: Style.barFontSize * 0.75
weight: Style.fontWeightBold
capitalization: Font.AllUppercase
}