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.
This commit is contained in:
Marco Allegretti 2026-05-29 11:05:42 +02:00
parent f09a1db84a
commit 2aae067337
2 changed files with 12 additions and 11 deletions

View file

@ -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

View file

@ -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) {"