mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-11 00:47:22 +00:00
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:
parent
f09a1db84a
commit
2aae067337
2 changed files with 12 additions and 11 deletions
|
|
@ -96,13 +96,13 @@ MouseArea {
|
||||||
property real pagerButtonWidth: showPager ? Math.min(root.height, Kirigami.Units.gridUnit * 2.5) : 0
|
property real pagerButtonWidth: showPager ? Math.min(root.height, Kirigami.Units.gridUnit * 2.5) : 0
|
||||||
property int pagerWheelDelta: 0
|
property int pagerWheelDelta: 0
|
||||||
property bool pagerWheelLocked: false
|
property bool pagerWheelLocked: false
|
||||||
readonly property int pagerLeftCount: showPager ? Math.ceil(virtualDesktopInfo.numberOfDesktops / 2) : 0
|
readonly property int pagerLeftCount: showPager ? virtualDesktopInfo.numberOfDesktops : 0
|
||||||
readonly property int pagerRightCount: showPager ? virtualDesktopInfo.numberOfDesktops - pagerLeftCount : 0
|
readonly property int pagerRightCount: 0
|
||||||
property real desktopButtonWidth: convergenceMode ? root.height : 0
|
property real desktopButtonWidth: convergenceMode ? root.height : 0
|
||||||
property real trashButtonWidth: convergenceMode ? root.height : 0
|
property real trashButtonWidth: convergenceMode ? root.height : 0
|
||||||
property real searchButtonWidth: convergenceMode ? root.height : 0
|
property real searchButtonWidth: convergenceMode ? root.height : 0
|
||||||
readonly property real leftControlsWidth: convergenceMode ? navButtonWidth + desktopButtonWidth + pagerLeftCount * pagerButtonWidth : 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
|
readonly property real dockCenterX: convergenceMode
|
||||||
? leftControlsWidth + (root.width - leftControlsWidth - rightControlsWidth) / 2
|
? leftControlsWidth + (root.width - leftControlsWidth - rightControlsWidth) / 2
|
||||||
: root.width / 2
|
: root.width / 2
|
||||||
|
|
@ -296,13 +296,6 @@ MouseArea {
|
||||||
if (x >= bx && x < bx + pagerButtonWidth)
|
if (x >= bx && x < bx + pagerButtonWidth)
|
||||||
return (ids && i < ids.length) ? String(ids[i]) : ""
|
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 ""
|
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 {
|
Repeater {
|
||||||
id: leftPagerRepeater
|
id: leftPagerRepeater
|
||||||
model: root.pagerLeftCount
|
model: root.pagerLeftCount
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,14 @@ require_line "$swipearea_header" "QTimer m_touchpadScrollEndTimer;"
|
||||||
require_line "$favourites_bar" "function handlePagerWheel(wheel)"
|
require_line "$favourites_bar" "function handlePagerWheel(wheel)"
|
||||||
require_line "$favourites_bar" "onWheel: (wheel) => root.handlePagerWheel(wheel)"
|
require_line "$favourites_bar" "onWheel: (wheel) => root.handlePagerWheel(wheel)"
|
||||||
require_line "$favourites_bar" "root.activateAdjacentDesktop(1)"
|
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" "onTouchpadScrollStarted: {"
|
||||||
require_line "$folio_home" "onTouchpadScrollMove: (totalDeltaX, totalDeltaY, deltaX, deltaY) => {"
|
require_line "$folio_home" "onTouchpadScrollMove: (totalDeltaX, totalDeltaY, deltaX, deltaY) => {"
|
||||||
require_line "$folio_home" "if (!ShellSettings.Settings.convergenceModeEnabled) {"
|
require_line "$folio_home" "if (!ShellSettings.Settings.convergenceModeEnabled) {"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue