Bar: some more rounding to improve icons clarity

This commit is contained in:
Lemmy
2025-12-19 20:51:22 -05:00
parent 6186b148eb
commit 23ecf0f139
5 changed files with 15 additions and 28 deletions
+5
View File
@@ -116,4 +116,9 @@ Singleton {
readonly property color capsuleBorderColor: Settings.data.bar.showOutline ? Color.mPrimary : Color.transparent
readonly property int capsuleBorderWidth: Settings.data.bar.showOutline ? Style.borderS : 0
// Pixel-perfect utility for centering content without subpixel positioning
function pixelAlignCenter(containerSize, contentSize) {
return Math.round((containerSize - contentSize) / 2);
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ Rectangle {
// Match Workspace widget pill sizing: base ratio depends on bar density
readonly property real pillBaseRatio: (density === "compact") ? 0.85 : 0.65
readonly property real pillHeight: Style.capsuleHeight * pillBaseRatio
readonly property int pillHeight: Math.round(Style.capsuleHeight * pillBaseRatio)
// Highlight colors
readonly property color warningColor: Settings.data.systemMonitor.useCustomColors ? (Settings.data.systemMonitor.warningColor || Color.mTertiary) : Color.mTertiary
+1 -1
View File
@@ -23,7 +23,7 @@ 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
readonly property real itemSize: (density === "compact") ? Style.capsuleHeight * 1.0 : Style.capsuleHeight * 0.9
readonly property int itemSize: Math.round((density === "compact") ? Style.capsuleHeight * 1.0 : Style.capsuleHeight * 0.9)
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: {
+6 -24
View File
@@ -56,7 +56,7 @@ Item {
readonly property bool colorizeIcons: (widgetSettings.colorizeIcons !== undefined) ? widgetSettings.colorizeIcons : widgetMetadata.colorizeIcons
readonly property bool enableScrollWheel: (widgetSettings.enableScrollWheel !== undefined) ? widgetSettings.enableScrollWheel : widgetMetadata.enableScrollWheel
readonly property real itemSize: (density === "compact") ? Style.capsuleHeight * 0.9 : Style.capsuleHeight * 0.8
readonly property int itemSize: Math.round(Style.capsuleHeight * 0.8)
// Context menu state for grouped mode
property var selectedWindow: null
@@ -83,12 +83,12 @@ Item {
implicitHeight: showApplications ? (isVertical ? Math.round(groupedGrid.implicitHeight + Style.marginM * 2) : Style.barHeight) : (isVertical ? computeHeight() : Style.barHeight)
function getWorkspaceWidth(ws) {
const d = Style.capsuleHeight * root.baseDimensionRatio;
const d = Math.round(Style.capsuleHeight * root.baseDimensionRatio);
const factor = ws.isActive ? 2.2 : 1;
// Don't calculate text width if labels are off
if (labelMode === "none") {
return d * factor;
return Math.round(d * factor);
}
var displayText = ws.idx.toString();
@@ -103,13 +103,13 @@ Item {
const textWidth = displayText.length * (d * 0.4); // Approximate width per character
const padding = d * 0.6;
return Math.max(d * factor, textWidth + padding);
return Math.round(Math.max(d * factor, textWidth + padding));
}
function getWorkspaceHeight(ws) {
const d = Style.capsuleHeight * root.baseDimensionRatio;
const d = Math.round(Style.capsuleHeight * root.baseDimensionRatio);
const factor = ws.isActive ? 2.2 : 1;
return d * factor;
return Math.round(d * factor);
}
function computeWidth() {
@@ -597,7 +597,6 @@ Item {
return Color.mOutline;
}
scale: model.isActive ? 1.0 : 0.9
z: 0
MouseArea {
@@ -740,15 +739,6 @@ Item {
width: root.itemSize
height: root.itemSize
scale: itemHovered ? 1.1 : 1.0
Behavior on scale {
NumberAnimation {
duration: Style.animationNormal
easing.type: Easing.OutBack
}
}
IconImage {
id: groupedAppIcon
@@ -757,16 +747,8 @@ Item {
source: ThemeIcons.iconForAppId(model.appId)
smooth: true
asynchronous: true
scale: model.isFocused ? 1.0 : 0.8
layer.enabled: root.colorizeIcons && !model.isFocused
Behavior on opacity {
NumberAnimation {
duration: Style.animationNormal
easing.type: Easing.InOutCubic
}
}
Rectangle {
id: groupedFocusIndicator
anchors.bottomMargin: 0
+2 -2
View File
@@ -172,7 +172,7 @@ Item {
const floatMarginH = isFloating ? Math.ceil(Settings.data.bar.marginHorizontal * Style.marginXL) : 0;
return Style.barHeight + floatMarginH;
}
readonly property int shadowPadding: Style.shadowBlurMax + Style.marginL
// Anchoring
@@ -212,4 +212,4 @@ Item {
}
}
}
}
}