Remove unused right-side desktop pager

All virtual desktop buttons now live beside the Desktop button, so the right-side pager branch can never render. Drop the dead delegate code and guard the dock invariant against reintroducing it.
This commit is contained in:
Marco Allegretti 2026-05-29 11:19:32 +02:00
parent b80c878487
commit 301e3f802b
2 changed files with 5 additions and 113 deletions

View file

@ -97,7 +97,6 @@ MouseArea {
property int pagerWheelDelta: 0
property bool pagerWheelLocked: false
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
@ -828,117 +827,7 @@ MouseArea {
}
}
// ---- Virtual desktop pager: right wing (desktops ceil(N/2)+1 .. N) ----
Repeater {
id: rightPagerRepeater
model: root.pagerRightCount
delegate: Item {
id: rightDesktopBtn
required property int index
readonly property int desktopIndex: root.pagerLeftCount + index
readonly property string desktopId: {
let ids = virtualDesktopInfo.desktopIds
return (ids && desktopIndex < ids.length) ? String(ids[desktopIndex]) : ""
}
readonly property bool isCurrent: desktopId !== "" && String(desktopId) === String(virtualDesktopInfo.currentDesktop)
readonly property bool isDragTarget: {
if (root.taskPinDragIndex < 0) return false
let cx = root.taskBaseX(root.taskPinDragIndex) + root.dockCellWidth / 2 + root.taskPinDragOffset
return root.pagerButtonDesktopAt(cx) === desktopId
}
x: root.width - root.navButtonWidth - root.searchButtonWidth - root.trashButtonWidth - (root.pagerRightCount - index) * root.pagerButtonWidth
y: 0
width: root.pagerButtonWidth
height: root.height
MobileShell.MotionStateLayer {
anchors.fill: parent
anchors.margins: root.dockItemInset
radius: Kirigami.Units.cornerRadius
hovered: rightPagerHover.containsMouse
pressed: rightPagerHover.containsPress
active: rightDesktopBtn.isCurrent || rightDesktopBtn.isDragTarget
pressedOpacity: 0.18
activeOpacity: 0.18
activeHoverOpacity: 0.25
}
PC3.Label {
anchors.centerIn: parent
text: (rightDesktopBtn.desktopIndex + 1).toString()
color: rightDesktopBtn.isCurrent ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor
font.pixelSize: Math.round(parent.height * 0.3)
font.bold: rightDesktopBtn.isCurrent
}
PC3.ToolTip {
visible: root.activeDockToolTipItem === rightDesktopBtn && rightPagerHover.containsMouse && !rightPagerHover.containsPress && !rightPagerContextMenu.opened
text: root.pagerDesktopName(rightDesktopBtn.desktopIndex)
}
MouseArea {
id: rightPagerHover
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: Qt.PointingHandCursor
onWheel: (wheel) => root.handlePagerWheel(wheel)
onClicked: (mouse) => {
root.hideDockToolTip(rightDesktopBtn)
if (mouse.button === Qt.RightButton) {
rightPagerContextMenu.open()
} else if (rightDesktopBtn.desktopId) {
root.folio.activateVirtualDesktop(rightDesktopBtn.desktopId)
}
}
onPressAndHold: {
root.hideDockToolTip(rightDesktopBtn)
rightPagerContextMenu.open()
haptics.buttonVibrate()
}
onContainsMouseChanged: {
if (containsMouse) {
root.requestDockToolTip(rightDesktopBtn)
} else {
root.hideDockToolTip(rightDesktopBtn)
}
}
onPressedChanged: {
if (pressed) {
root.hideDockToolTip(rightDesktopBtn)
}
}
}
PC3.Menu {
id: rightPagerContextMenu
popupType: T.Popup.Window
PC3.MenuItem {
icon.name: "list-add"
text: i18n("Add Virtual Desktop")
onTriggered: root.folio.createVirtualDesktop()
}
PC3.MenuItem {
icon.name: "list-remove"
text: i18n("Remove Virtual Desktop")
enabled: virtualDesktopInfo.numberOfDesktops > 1
onTriggered: root.folio.removeLastVirtualDesktop()
}
Controls.MenuSeparator {}
PC3.MenuItem {
icon.name: "preferences-desktop-virtual"
text: i18n("Configure Virtual Desktops…")
onTriggered: MobileShell.ShellUtil.executeCommand("plasma-open-settings kcm_kwin_virtualdesktops")
}
}
}
}
// ---- Trash button (convergence mode, sits between the right pager wing and the Overview button) ----
// ---- Trash button (convergence mode, sits between Search and Overview) ----
// Watches ~/.local/share/Trash/files to detect empty/full state.
// FolderListModel reacts to directory changes automatically.

View file

@ -89,7 +89,6 @@ 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"
require_line "$favourites_bar" "function focusFirstDockContent()"
@ -102,6 +101,10 @@ if grep -Fq "Math.ceil(virtualDesktopInfo.numberOfDesktops / 2)" "$favourites_ba
echo "Desktop pager must not split virtual desktops between dock edges" >&2
exit 1
fi
if grep -Fq "rightPager" "$favourites_bar"; then
echo "Desktop pager must not keep an unused right-side branch" >&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) {"