Bar: better font sizing + workspace fix

This commit is contained in:
Lemmy
2026-01-02 10:39:05 -05:00
parent 04ffcc7ed8
commit 9b92d6752b
30 changed files with 43 additions and 82 deletions
+5 -5
View File
@@ -108,7 +108,7 @@ Singleton {
return toOdd(h);
}
// Capsule Height -
// Capsule Height
readonly property real capsuleHeight: {
let h;
switch (Settings.data.bar.density) {
@@ -122,17 +122,17 @@ Singleton {
h = Math.round(barHeight * 0.75);
break;
case "spacious":
h = Math.round(barHeight * 0.75);
h = Math.round(barHeight * 0.65);
break;
default:
case "default":
h = Math.round(barHeight * 0.82);
break;
}
return toOdd(h);
}
// The base/default font size for all text in the bar. 33 is the "default" barHeight
readonly property real _barBaseFontSize: Math.max(1, (Style.barHeight / 33) * Style.fontSizeS)
// The base/default font size for all texts in the bar
readonly property real _barBaseFontSize: Math.max(1, (Style.barHeight / Style.capsuleHeight) * Style.fontSizeXXS)
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
-3
View File
@@ -13,7 +13,6 @@ Item {
property string text: ""
property string suffix: ""
property string tooltipText: ""
property string density: ""
property bool autoHide: false
property bool forceOpen: false
property bool forceClose: false
@@ -57,7 +56,6 @@ Item {
forceClose: root.forceClose
oppositeDirection: root.oppositeDirection
hovered: root.hovered
density: root.density
rotateText: root.rotateText
customBackgroundColor: root.customBackgroundColor
customTextIconColor: root.customTextIconColor
@@ -85,7 +83,6 @@ Item {
forceClose: root.forceClose
oppositeDirection: root.oppositeDirection
hovered: root.hovered
density: root.density
customBackgroundColor: root.customBackgroundColor
customTextIconColor: root.customTextIconColor
onShown: root.shown()
-1
View File
@@ -14,7 +14,6 @@ Item {
property string text: ""
property string suffix: ""
property string tooltipText: ""
property string density: ""
property bool autoHide: false
property bool forceOpen: false
property bool forceClose: false
-1
View File
@@ -14,7 +14,6 @@ Item {
property string text: ""
property string suffix: ""
property string tooltipText: ""
property string density: ""
property bool autoHide: false
property bool forceOpen: false
property bool forceClose: false
-1
View File
@@ -198,7 +198,6 @@ Item {
id: pill
screen: root.screen
density: Settings.data.bar.density
oppositeDirection: BarService.getPillDirection(root)
icon: testMode ? BatteryService.getIcon(testPercent, testCharging, true) : BatteryService.getIcon(percent, charging, isReady)
text: (isReady || testMode) ? Math.round(percent) : "-"
-1
View File
@@ -69,7 +69,6 @@ Item {
id: pill
screen: root.screen
density: Settings.data.bar.density
oppositeDirection: BarService.getPillDirection(root)
icon: !BluetoothService.enabled ? "bluetooth-off" : ((BluetoothService.connectedDevices && BluetoothService.connectedDevices.length > 0) ? "bluetooth-connected" : "bluetooth")
text: {
-1
View File
@@ -114,7 +114,6 @@ Item {
id: pill
screen: root.screen
density: Settings.data.bar.density
oppositeDirection: BarService.getPillDirection(root)
icon: getIcon()
autoHide: false // Important to be false so we can hover as long as we want
-2
View File
@@ -31,8 +31,6 @@ Rectangle {
readonly property string barPosition: Settings.data.bar.position
readonly property bool isBarVertical: barPosition === "left" || barPosition === "right"
readonly property bool density: Settings.data.bar.density
readonly property var now: Time.now
// Resolve settings: try user settings or defaults from BarWidgetRegistry
-1
View File
@@ -85,7 +85,6 @@ NIconButton {
tooltipDirection: BarService.getTooltipDirection()
baseSize: Style.capsuleHeight
applyUiScale: false
density: Settings.data.bar.density
customRadius: Style.radiusL
colorBg: Style.capsuleColor
colorFg: iconColor
-1
View File
@@ -142,7 +142,6 @@ Item {
oppositeDirection: BarService.getPillDirection(root)
icon: _pillIcon
text: _pillText
density: Settings.data.bar.density
rotateText: isVerticalBar && currentMaxTextLength > 0
autoHide: false
forceOpen: _pillForceOpen
+1 -2
View File
@@ -11,14 +11,13 @@ NIconButton {
icon: "dark-mode"
tooltipText: Settings.data.colorSchemes.darkMode ? I18n.tr("tooltips.switch-to-light-mode") : I18n.tr("tooltips.switch-to-dark-mode")
tooltipDirection: BarService.getTooltipDirection()
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
customRadius: Style.radiusL
colorBg: Style.capsuleColor
colorFg: Color.mOnSurface
colorBorder: Color.transparent
colorBorderHover: Color.transparent
colorBorderHover: Color.transphaarent
onClicked: Settings.data.colorSchemes.darkMode = !Settings.data.colorSchemes.darkMode
border.color: Style.capsuleBorderColor
-1
View File
@@ -39,7 +39,6 @@ Item {
screen: root.screen
text: IdleInhibitorService.timeout == null ? "" : Time.formatVagueHumanReadableDuration(IdleInhibitorService.timeout)
density: Settings.data.bar.density
oppositeDirection: BarService.getPillDirection(root)
icon: IdleInhibitorService.isInhibited ? "keep-awake-on" : "keep-awake-off"
tooltipText: IdleInhibitorService.isInhibited ? I18n.tr("tooltips.disable-keep-awake") : I18n.tr("tooltips.enable-keep-awake")
-2
View File
@@ -67,9 +67,7 @@ Item {
BarPill {
id: pill
anchors.verticalCenter: parent.verticalCenter
screen: root.screen
density: Settings.data.bar.density
oppositeDirection: BarService.getPillDirection(root)
icon: root.showIcon ? "keyboard" : ""
autoHide: false // Important to be false so we can hover as long as we want
-1
View File
@@ -132,7 +132,6 @@ Item {
screen: root.screen
oppositeDirection: BarService.getPillDirection(root)
icon: AudioService.getInputIcon()
density: Settings.data.bar.density
autoHide: false // Important to be false so we can hover as long as we want
text: {
const maxVolume = Settings.data.audio.volumeOverdrive ? 1.5 : 1.0;
-1
View File
@@ -14,7 +14,6 @@ NIconButton {
property ShellScreen screen
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
customRadius: Style.radiusL
@@ -14,7 +14,6 @@ NIconButton {
property ShellScreen screen
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
customRadius: Style.radiusL
@@ -50,7 +50,6 @@ NIconButton {
baseSize: Style.capsuleHeight
applyUiScale: false
density: Settings.data.bar.density
customRadius: Style.radiusL
icon: NotificationService.doNotDisturb ? "bell-off" : "bell"
tooltipText: NotificationService.doNotDisturb ? I18n.tr("tooltips.open-notification-history-disable-dnd") : I18n.tr("tooltips.open-notification-history-enable-dnd")
-1
View File
@@ -14,7 +14,6 @@ NIconButton {
baseSize: Style.capsuleHeight
applyUiScale: false
density: Settings.data.bar.density
customRadius: Style.radiusL
visible: PowerProfileService.available
icon: PowerProfileService.getIcon()
-1
View File
@@ -22,7 +22,6 @@ NIconButton {
icon: ScreenRecorderService.isPending ? "" : "camera-video"
tooltipText: ScreenRecorderService.isRecording ? I18n.tr("tooltips.click-to-stop-recording") : I18n.tr("tooltips.click-to-start-recording")
tooltipDirection: BarService.getTooltipDirection()
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
customRadius: Style.radiusL
-1
View File
@@ -47,7 +47,6 @@ NIconButton {
}
}
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
customRadius: Style.radiusL
+33 -33
View File
@@ -49,7 +49,7 @@ 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 * 0.55)
readonly property real iconSize: Style.toOdd(Style.capsuleHeight * 0.48)
readonly property real miniGaugeWidth: Math.max(3, Style.toOdd(root.iconSize * 0.25))
function openExternalMonitor() {
@@ -251,18 +251,18 @@ Rectangle {
columnSpacing: compactMode ? 3 : Style.marginXS
Item {
Layout.preferredWidth: iconSize
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
Layout.alignment: Qt.AlignCenter
Layout.row: (isVertical && !compactMode) ? 1 : 0
Layout.column: 0
Layout.fillWidth: isVertical
implicitWidth: iconSize
implicitHeight: iconSize
NIcon {
icon: "cpu-usage"
pointSize: iconSize
applyUiScale: false
anchors.centerIn: parent
x: Style.pixelAlignCenter(parent.width, width)
y: Style.pixelAlignCenter(parent.height, contentHeight)
color: (cpuWarning || cpuCritical) ? SystemStatService.cpuColor : Color.mOnSurface
}
}
@@ -326,18 +326,18 @@ Rectangle {
columnSpacing: compactMode ? 3 : Style.marginXS
Item {
Layout.preferredWidth: iconSize
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
Layout.alignment: Qt.AlignCenter
Layout.row: (isVertical && !compactMode) ? 1 : 0
Layout.column: 0
Layout.fillWidth: isVertical
implicitWidth: iconSize
implicitHeight: iconSize
NIcon {
icon: "cpu-temperature"
pointSize: iconSize
applyUiScale: false
anchors.centerIn: parent
x: Style.pixelAlignCenter(parent.width, width)
y: Style.pixelAlignCenter(parent.height, contentHeight)
color: (tempWarning || tempCritical) ? SystemStatService.tempColor : Color.mOnSurface
}
}
@@ -394,18 +394,18 @@ Rectangle {
columnSpacing: compactMode ? 3 : Style.marginXS
Item {
Layout.preferredWidth: iconSize
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
Layout.alignment: Qt.AlignCenter
Layout.row: (isVertical && !compactMode) ? 1 : 0
Layout.column: 0
Layout.fillWidth: isVertical
implicitWidth: iconSize
implicitHeight: iconSize
NIcon {
icon: "gpu-temperature"
pointSize: iconSize
applyUiScale: false
anchors.centerIn: parent
x: Style.pixelAlignCenter(parent.width, width)
y: Style.pixelAlignCenter(parent.height, contentHeight)
color: (gpuWarning || gpuCritical) ? SystemStatService.gpuColor : Color.mOnSurface
}
}
@@ -462,18 +462,18 @@ Rectangle {
columnSpacing: compactMode ? 3 : Style.marginXS
Item {
Layout.preferredWidth: iconSize
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
Layout.alignment: Qt.AlignCenter
Layout.row: (isVertical && !compactMode) ? 1 : 0
Layout.column: 0
Layout.fillWidth: isVertical
implicitWidth: iconSize
implicitHeight: iconSize
NIcon {
icon: "weight"
pointSize: iconSize
applyUiScale: false
anchors.centerIn: parent
x: Style.pixelAlignCenter(parent.width, width)
y: Style.pixelAlignCenter(parent.height, contentHeight)
color: Color.mOnSurface
}
}
@@ -530,18 +530,18 @@ Rectangle {
columnSpacing: compactMode ? 3 : Style.marginXS
Item {
Layout.preferredWidth: iconSize
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
Layout.alignment: Qt.AlignCenter
Layout.row: (isVertical && !compactMode) ? 1 : 0
Layout.column: 0
Layout.fillWidth: isVertical
implicitWidth: iconSize
implicitHeight: iconSize
NIcon {
icon: "memory"
pointSize: iconSize
applyUiScale: false
anchors.centerIn: parent
x: Style.pixelAlignCenter(parent.width, width)
y: Style.pixelAlignCenter(parent.height, contentHeight)
color: (memWarning || memCritical) ? SystemStatService.memColor : Color.mOnSurface
}
}
@@ -597,18 +597,18 @@ Rectangle {
columnSpacing: compactMode ? 3 : Style.marginXS
Item {
Layout.preferredWidth: iconSize
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
Layout.alignment: Qt.AlignCenter
Layout.row: (isVertical && !compactMode) ? 1 : 0
Layout.column: 0
Layout.fillWidth: isVertical
implicitWidth: iconSize
implicitHeight: iconSize
NIcon {
icon: "download-speed"
pointSize: iconSize
applyUiScale: false
anchors.centerIn: parent
x: Style.pixelAlignCenter(parent.width, width)
y: Style.pixelAlignCenter(parent.height, contentHeight)
}
}
@@ -662,18 +662,18 @@ Rectangle {
columnSpacing: compactMode ? 3 : Style.marginXS
Item {
Layout.preferredWidth: iconSize
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
Layout.alignment: Qt.AlignCenter
Layout.row: (isVertical && !compactMode) ? 1 : 0
Layout.column: 0
Layout.fillWidth: isVertical
implicitWidth: iconSize
implicitHeight: iconSize
NIcon {
icon: "upload-speed"
pointSize: iconSize
applyUiScale: false
anchors.centerIn: parent
x: Style.pixelAlignCenter(parent.width, width)
y: Style.pixelAlignCenter(parent.height, contentHeight)
}
}
@@ -728,18 +728,18 @@ Rectangle {
columnSpacing: compactMode ? 3 : Style.marginXS
Item {
Layout.preferredWidth: iconSize
Layout.preferredHeight: compactMode ? iconSize : Style.capsuleHeight
Layout.alignment: Qt.AlignCenter
Layout.row: (isVertical && !compactMode) ? 1 : 0
Layout.column: 0
Layout.fillWidth: isVertical
implicitWidth: iconSize
implicitHeight: iconSize
NIcon {
icon: "storage"
pointSize: iconSize
applyUiScale: false
anchors.centerIn: parent
x: Style.pixelAlignCenter(parent.width, width)
y: Style.pixelAlignCenter(parent.height, contentHeight)
color: (diskWarning || diskCritical) ? SystemStatService.getDiskColor(diskPath) : Color.mOnSurface
}
}
-1
View File
@@ -22,7 +22,6 @@ Rectangle {
readonly property string barPosition: Settings.data.bar.position
readonly property bool isVerticalBar: barPosition === "left" || barPosition === "right"
readonly property string density: Settings.data.bar.density
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: {
-2
View File
@@ -291,7 +291,6 @@ Rectangle {
visible: root.drawerEnabled && dropdownItems.length > 0 && BarService.getPillDirection(root)
tooltipText: I18n.tr("tooltips.open-tray-dropdown")
tooltipDirection: BarService.getTooltipDirection()
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
customRadius: Style.radiusL
@@ -448,7 +447,6 @@ Rectangle {
visible: root.drawerEnabled && dropdownItems.length > 0 && !BarService.getPillDirection(root)
tooltipText: I18n.tr("tooltips.open-tray-dropdown")
tooltipDirection: BarService.getTooltipDirection()
density: Settings.data.bar.density
baseSize: Style.capsuleHeight
applyUiScale: false
customRadius: Style.radiusL
-1
View File
@@ -97,7 +97,6 @@ Item {
id: pill
screen: root.screen
density: Settings.data.bar.density
oppositeDirection: BarService.getPillDirection(root)
icon: VPNService.hasActiveConnection ? "shield-lock" : "shield"
text: {
-1
View File
@@ -113,7 +113,6 @@ Item {
id: pill
screen: root.screen
density: Settings.data.bar.density
oppositeDirection: BarService.getPillDirection(root)
icon: AudioService.getOutputIcon()
autoHide: false // Important to be false so we can hover as long as we want
@@ -14,7 +14,6 @@ NIconButton {
baseSize: Style.capsuleHeight
applyUiScale: false
density: Settings.data.bar.density
customRadius: Style.radiusL
icon: "wallpaper-selector"
tooltipText: I18n.tr("tooltips.open-wallpaper-selector")
-1
View File
@@ -69,7 +69,6 @@ Item {
id: pill
screen: root.screen
density: Settings.data.bar.density
oppositeDirection: BarService.getPillDirection(root)
icon: {
try {
+1 -1
View File
@@ -36,7 +36,7 @@ Item {
readonly property string barPosition: Settings.data.bar.position
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
readonly property real baseDimensionRatio: Style.barScaling * 0.65 * (widgetSettings.labelMode === "none" ? 0.75 : 1)
readonly property real baseDimensionRatio: 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
+3 -11
View File
@@ -13,7 +13,6 @@ Rectangle {
property string icon
property string tooltipText
property string tooltipDirection: "auto"
property string density: ""
property bool enabled: true
property bool allowClickWhenDisabled: false
property bool hovering: false
@@ -33,8 +32,8 @@ Rectangle {
signal middleClicked
signal wheel(int angleDelta)
implicitWidth: applyUiScale ? Math.round(baseSize * Style.uiScaleRatio) : Math.round(baseSize)
implicitHeight: applyUiScale ? Math.round(baseSize * Style.uiScaleRatio) : Math.round(baseSize)
implicitWidth: applyUiScale ? Style.toOdd(baseSize * Style.uiScaleRatio) : Style.toOdd(baseSize)
implicitHeight: applyUiScale ? Style.toOdd(baseSize * Style.uiScaleRatio) : Style.toOdd(baseSize)
opacity: root.enabled ? Style.opacityFull : Style.opacityMedium
color: root.enabled && root.hovering ? colorBgHover : colorBg
@@ -51,14 +50,7 @@ Rectangle {
NIcon {
icon: root.icon
pointSize: {
switch (root.density) {
case "compact":
return Math.max(1, root.width * 0.65);
default:
return Math.max(1, root.width * 0.48);
}
}
pointSize: Style.toOdd(root.width * 0.48)
applyUiScale: root.applyUiScale
color: root.enabled && root.hovering ? colorFgHover : colorFg
// Pixel-perfect centering
-1
View File
@@ -14,7 +14,6 @@ Rectangle {
property string icon: ""
property string tooltipText: ""
property string tooltipDirection: "auto"
property string density: ""
property bool enabled: true
property bool allowClickWhenDisabled: false
property bool hot: false