From f4e369780367c4c27c2a4541e74518d42c034a62 Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 13 Oct 2026 13:49:03 -0400 Subject: [PATCH] bar: center apps dock icons and separator on the bar fixes #3776 --- quickshell/Modules/Dock/DockAppButton.qml | 8 ++------ quickshell/Modules/Dock/DockLauncherButton.qml | 4 ---- quickshell/Modules/Dock/DockOverflowButton.qml | 4 ---- quickshell/Modules/Dock/DockTrashButton.qml | 4 ---- quickshell/Modules/SurfaceWidgets/ApplicationItem.qml | 9 ++------- quickshell/Modules/SurfaceWidgets/ApplicationStrip.qml | 3 ++- 6 files changed, 6 insertions(+), 26 deletions(-) diff --git a/quickshell/Modules/Dock/DockAppButton.qml b/quickshell/Modules/Dock/DockAppButton.qml index 292b34f56..e5524137d 100644 --- a/quickshell/Modules/Dock/DockAppButton.qml +++ b/quickshell/Modules/Dock/DockAppButton.qml @@ -28,10 +28,9 @@ Item { property bool showTooltip: mouseArea.containsMouse && !dragging property var cachedDesktopEntry: dockApps?.desktopEntries[appData?.appId] ?? null property real actualIconSize: 40 - property real indicatorLane: 0 readonly property bool indicatorAtFarEdge: root.options.position === SettingsData.Position.Bottom || root.options.position === SettingsData.Position.Right readonly property bool indicatorInPadding: !(root.dockApps?.barHosted ?? false) - readonly property real indicatorThickness: indicatorInPadding ? root.options.spacing : indicatorLane + readonly property real indicatorThickness: indicatorInPadding ? root.options.spacing : Math.max(0, ((isVertical ? width : height) - actualIconSize) / 2) property bool shouldShowIndicator: { if (root.options.hideIndicators) return false; @@ -447,10 +446,7 @@ Item { Item { id: iconSlot - x: root.isVertical && !root.indicatorAtFarEdge ? root.indicatorLane : 0 - y: !root.isVertical && !root.indicatorAtFarEdge ? root.indicatorLane : 0 - width: parent.width - (root.isVertical ? root.indicatorLane : 0) - height: parent.height - (root.isVertical ? 0 : root.indicatorLane) + anchors.fill: parent scale: !root.options?.magnification && root.options?.enlargeOnHover && root.isHovered ? (root.options?.enlargePercentage ?? 125) / 100 : 1 AppIconRenderer { diff --git a/quickshell/Modules/Dock/DockLauncherButton.qml b/quickshell/Modules/Dock/DockLauncherButton.qml index f5ea283c8..672d5edcb 100644 --- a/quickshell/Modules/Dock/DockLauncherButton.qml +++ b/quickshell/Modules/Dock/DockLauncherButton.qml @@ -40,8 +40,6 @@ Item { } } - property real indicatorLane: 0 - readonly property real laneOffset: (root.options.position === SettingsData.Position.Bottom || root.options.position === SettingsData.Position.Right ? -1 : 1) * root.indicatorLane / 2 readonly property real hoverAnimOffset: hoverBounce.offset DockHoverBounce { @@ -64,8 +62,6 @@ Item { Item { anchors.centerIn: parent - anchors.horizontalCenterOffset: root.isVertical ? root.laneOffset : 0 - anchors.verticalCenterOffset: root.isVertical ? 0 : root.laneOffset width: actualIconSize height: actualIconSize scale: !root.options?.magnification && root.options?.enlargeOnHover && root.isHovered ? (root.options?.enlargePercentage ?? 125) / 100 : 1 diff --git a/quickshell/Modules/Dock/DockOverflowButton.qml b/quickshell/Modules/Dock/DockOverflowButton.qml index d692a1fd7..c48d303cb 100644 --- a/quickshell/Modules/Dock/DockOverflowButton.qml +++ b/quickshell/Modules/Dock/DockOverflowButton.qml @@ -6,8 +6,6 @@ Item { id: root required property var options - property real indicatorLane: 0 - readonly property real laneOffset: (root.options.position === SettingsData.Position.Bottom || root.options.position === SettingsData.Position.Right ? -1 : 1) * root.indicatorLane / 2 property color iconColor: Theme.surfaceText property real actualIconSize: 40 property int overflowCount: 0 @@ -22,8 +20,6 @@ Item { Rectangle { id: buttonBackground anchors.centerIn: parent - anchors.horizontalCenterOffset: root.isVertical ? root.laneOffset : 0 - anchors.verticalCenterOffset: root.isVertical ? 0 : root.laneOffset width: actualIconSize height: actualIconSize radius: Theme.cornerRadius diff --git a/quickshell/Modules/Dock/DockTrashButton.qml b/quickshell/Modules/Dock/DockTrashButton.qml index 2bb6e7798..8c56b41f1 100644 --- a/quickshell/Modules/Dock/DockTrashButton.qml +++ b/quickshell/Modules/Dock/DockTrashButton.qml @@ -13,8 +13,6 @@ Item { property var dockApps: null property var contextMenu: null property var parentDockScreen: null - property real indicatorLane: 0 - readonly property real laneOffset: (root.options.position === SettingsData.Position.Bottom || root.options.position === SettingsData.Position.Right ? -1 : 1) * root.indicatorLane / 2 property real actualIconSize: 40 readonly property real hoverAnimOffset: hoverBounce.offset @@ -67,8 +65,6 @@ Item { Item { anchors.centerIn: parent - anchors.horizontalCenterOffset: root.isVertical ? root.laneOffset : 0 - anchors.verticalCenterOffset: root.isVertical ? 0 : root.laneOffset width: actualIconSize - 4 height: actualIconSize - 4 scale: !root.options?.magnification && root.options?.enlargeOnHover && root.isHovered ? (root.options?.enlargePercentage ?? 125) / 100 : 1 diff --git a/quickshell/Modules/SurfaceWidgets/ApplicationItem.qml b/quickshell/Modules/SurfaceWidgets/ApplicationItem.qml index 19c0ce79e..e5a63c7be 100644 --- a/quickshell/Modules/SurfaceWidgets/ApplicationItem.qml +++ b/quickshell/Modules/SurfaceWidgets/ApplicationItem.qml @@ -84,10 +84,9 @@ Item { return strip.targetSize + Theme.listItemHeight * 2; return strip.targetSize; } - readonly property real crossSize: itemData.type === "separator" ? strip.iconSize : strip.crossSize - width: collapsed ? 0 : (strip.isVertical ? crossSize : primarySize) - height: collapsed ? 0 : (strip.isVertical ? primarySize : crossSize) + width: collapsed ? 0 : (strip.isVertical ? strip.crossSize : primarySize) + height: collapsed ? 0 : (strip.isVertical ? primarySize : strip.crossSize) Behavior on opacity { NumberAnimation { @@ -159,7 +158,6 @@ Item { anchors.centerIn: parent width: delegateItem.width height: delegateItem.height - indicatorLane: strip.indicatorLane actualIconSize: strip.iconSize * (strip.options.iconSizePercentage ?? 100) / 100 overflowCount: itemData.overflowCount || 0 overflowExpanded: strip.overflowExpanded @@ -174,7 +172,6 @@ Item { anchors.centerIn: parent width: delegateItem.width height: delegateItem.height - indicatorLane: strip.indicatorLane actualIconSize: strip.iconSize * (strip.options.iconSizePercentage ?? 100) / 100 dockApps: strip } @@ -186,7 +183,6 @@ Item { anchors.centerIn: parent width: delegateItem.width height: delegateItem.height - indicatorLane: strip.indicatorLane actualIconSize: strip.iconSize * (strip.options.iconSizePercentage ?? 100) / 100 dockApps: strip contextMenu: strip.trashContextMenu @@ -200,7 +196,6 @@ Item { anchors.centerIn: parent width: delegateItem.width height: delegateItem.height - indicatorLane: strip.indicatorLane actualIconSize: strip.iconSize * (strip.options.iconSizePercentage ?? 100) / 100 appData: itemData contextMenu: strip.contextMenu diff --git a/quickshell/Modules/SurfaceWidgets/ApplicationStrip.qml b/quickshell/Modules/SurfaceWidgets/ApplicationStrip.qml index c0fd05e3f..48662a438 100644 --- a/quickshell/Modules/SurfaceWidgets/ApplicationStrip.qml +++ b/quickshell/Modules/SurfaceWidgets/ApplicationStrip.qml @@ -105,7 +105,8 @@ Item { readonly property real targetSize: barHosted ? iconSize * (options.iconSizePercentage ?? 100) / 100 : iconSize readonly property real indicatorLane: root.barHosted && !root.options.hideIndicators ? DockConfig.indicatorLane(root.options) : 0 readonly property real crossSize: { - const needed = root.targetSize + root.indicatorLane; + // The lane is mirrored so icons stay centered on the bar. + const needed = root.targetSize + root.indicatorLane * 2; if (!root.barHosted) return needed; // A bar pill cannot grow past its widget thickness, so the lane yields there.