From 23ecf0f13966f39131d7049423a2b0bb85a2281b Mon Sep 17 00:00:00 2001 From: Lemmy Date: Fri, 19 Dec 2025 20:51:22 -0500 Subject: [PATCH] Bar: some more rounding to improve icons clarity --- Commons/Style.qml | 5 +++++ Modules/Bar/Widgets/SystemMonitor.qml | 2 +- Modules/Bar/Widgets/Taskbar.qml | 2 +- Modules/Bar/Widgets/Workspace.qml | 30 ++++++--------------------- Modules/Toast/ToastScreen.qml | 4 ++-- 5 files changed, 15 insertions(+), 28 deletions(-) diff --git a/Commons/Style.qml b/Commons/Style.qml index b2fc48a2a..fd1c6bcab 100644 --- a/Commons/Style.qml +++ b/Commons/Style.qml @@ -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); + } } diff --git a/Modules/Bar/Widgets/SystemMonitor.qml b/Modules/Bar/Widgets/SystemMonitor.qml index e5ddf1123..92f5b8910 100644 --- a/Modules/Bar/Widgets/SystemMonitor.qml +++ b/Modules/Bar/Widgets/SystemMonitor.qml @@ -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 diff --git a/Modules/Bar/Widgets/Taskbar.qml b/Modules/Bar/Widgets/Taskbar.qml index 4cb7ffbba..224089809 100644 --- a/Modules/Bar/Widgets/Taskbar.qml +++ b/Modules/Bar/Widgets/Taskbar.qml @@ -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: { diff --git a/Modules/Bar/Widgets/Workspace.qml b/Modules/Bar/Widgets/Workspace.qml index b2589fd16..8eea2af9a 100644 --- a/Modules/Bar/Widgets/Workspace.qml +++ b/Modules/Bar/Widgets/Workspace.qml @@ -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 diff --git a/Modules/Toast/ToastScreen.qml b/Modules/Toast/ToastScreen.qml index 63e55c271..09cfbcae3 100644 --- a/Modules/Toast/ToastScreen.qml +++ b/Modules/Toast/ToastScreen.qml @@ -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 { } } } -} \ No newline at end of file +}