From 2aae06733770d5789e9395ec6e04faa4b3925bea Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Fri, 29 May 2026 11:05:42 +0200 Subject: [PATCH] Keep desktop pager buttons together in dock Show all virtual desktop buttons as one compact group next to the Desktop button instead of splitting them across both dock edges. Update the convergence dock invariant so this layout does not regress. --- .../homescreens/folio/qml/FavouritesBar.qml | 15 ++++----------- tests/check-convergence-dock-invariant.sh | 8 ++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/containments/homescreens/folio/qml/FavouritesBar.qml b/containments/homescreens/folio/qml/FavouritesBar.qml index 6eacc5c2..700c9ec6 100644 --- a/containments/homescreens/folio/qml/FavouritesBar.qml +++ b/containments/homescreens/folio/qml/FavouritesBar.qml @@ -96,13 +96,13 @@ MouseArea { property real pagerButtonWidth: showPager ? Math.min(root.height, Kirigami.Units.gridUnit * 2.5) : 0 property int pagerWheelDelta: 0 property bool pagerWheelLocked: false - readonly property int pagerLeftCount: showPager ? Math.ceil(virtualDesktopInfo.numberOfDesktops / 2) : 0 - readonly property int pagerRightCount: showPager ? virtualDesktopInfo.numberOfDesktops - pagerLeftCount : 0 + readonly property int pagerLeftCount: showPager ? virtualDesktopInfo.numberOfDesktops : 0 + readonly property int pagerRightCount: 0 property real desktopButtonWidth: convergenceMode ? root.height : 0 property real trashButtonWidth: convergenceMode ? root.height : 0 property real searchButtonWidth: convergenceMode ? root.height : 0 readonly property real leftControlsWidth: convergenceMode ? navButtonWidth + desktopButtonWidth + pagerLeftCount * pagerButtonWidth : 0 - readonly property real rightControlsWidth: convergenceMode ? navButtonWidth + searchButtonWidth + trashButtonWidth + pagerRightCount * pagerButtonWidth : 0 + readonly property real rightControlsWidth: convergenceMode ? navButtonWidth + searchButtonWidth + trashButtonWidth : 0 readonly property real dockCenterX: convergenceMode ? leftControlsWidth + (root.width - leftControlsWidth - rightControlsWidth) / 2 : root.width / 2 @@ -296,13 +296,6 @@ MouseArea { if (x >= bx && x < bx + pagerButtonWidth) return (ids && i < ids.length) ? String(ids[i]) : "" } - for (let i = 0; i < pagerRightCount; ++i) { - let bx = root.width - navButtonWidth - root.searchButtonWidth - root.trashButtonWidth - (pagerRightCount - i) * pagerButtonWidth - if (x >= bx && x < bx + pagerButtonWidth) { - let di = pagerLeftCount + i - return (ids && di < ids.length) ? String(ids[di]) : "" - } - } return "" } @@ -684,7 +677,7 @@ MouseArea { } } - // ---- Virtual desktop pager: left wing (desktops 1 .. ceil(N/2)) ---- + // ---- Virtual desktop pager: compact group next to the Desktop button ---- Repeater { id: leftPagerRepeater model: root.pagerLeftCount diff --git a/tests/check-convergence-dock-invariant.sh b/tests/check-convergence-dock-invariant.sh index 36bf02bf..9b6bb0c5 100644 --- a/tests/check-convergence-dock-invariant.sh +++ b/tests/check-convergence-dock-invariant.sh @@ -88,6 +88,14 @@ require_line "$swipearea_header" "QTimer m_touchpadScrollEndTimer;" require_line "$favourites_bar" "function handlePagerWheel(wheel)" require_line "$favourites_bar" "onWheel: (wheel) => root.handlePagerWheel(wheel)" require_line "$favourites_bar" "root.activateAdjacentDesktop(1)" +require_line "$favourites_bar" "readonly property int pagerLeftCount: showPager ? virtualDesktopInfo.numberOfDesktops : 0" +require_line "$favourites_bar" "readonly property int pagerRightCount: 0" +require_line "$favourites_bar" "readonly property real rightControlsWidth: convergenceMode ? navButtonWidth + searchButtonWidth + trashButtonWidth : 0" +require_line "$favourites_bar" "Virtual desktop pager: compact group next to the Desktop button" +if grep -Fq "Math.ceil(virtualDesktopInfo.numberOfDesktops / 2)" "$favourites_bar"; then + echo "Desktop pager must not split virtual desktops between dock edges" >&2 + exit 1 +fi require_line "$folio_home" "onTouchpadScrollStarted: {" require_line "$folio_home" "onTouchpadScrollMove: (totalDeltaX, totalDeltaY, deltaX, deltaY) => {" require_line "$folio_home" "if (!ShellSettings.Settings.convergenceModeEnabled) {"