mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
Map shoulder buttons, Start, and right stick
LB/RB cycle through source filter tabs (All/Steam/Desktop). Start toggles focus between the search field and the grid. Right stick Y-axis smoothly scrolls the grid at 60 Hz with speed proportional to deflection. Update the gamepad legend to show the new bindings.
This commit is contained in:
parent
764a8708f6
commit
a1044567cd
1 changed files with 43 additions and 1 deletions
|
|
@ -110,6 +110,19 @@ Window {
|
||||||
case GamingShell.GamepadManager.ButtonY:
|
case GamingShell.GamepadManager.ButtonY:
|
||||||
root.requestExitGamingMode()
|
root.requestExitGamingMode()
|
||||||
break
|
break
|
||||||
|
case GamingShell.GamepadManager.ButtonLeftShoulder:
|
||||||
|
root.cycleSourceFilter(-1)
|
||||||
|
break
|
||||||
|
case GamingShell.GamepadManager.ButtonRightShoulder:
|
||||||
|
root.cycleSourceFilter(1)
|
||||||
|
break
|
||||||
|
case GamingShell.GamepadManager.ButtonStart:
|
||||||
|
if (searchField.activeFocus) {
|
||||||
|
grid.forceActiveFocus()
|
||||||
|
} else {
|
||||||
|
searchField.forceActiveFocus()
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,6 +131,8 @@ Window {
|
||||||
stickState.leftX = value
|
stickState.leftX = value
|
||||||
} else if (axis === GamingShell.GamepadManager.AxisLeftY) {
|
} else if (axis === GamingShell.GamepadManager.AxisLeftY) {
|
||||||
stickState.leftY = value
|
stickState.leftY = value
|
||||||
|
} else if (axis === GamingShell.GamepadManager.AxisRightY) {
|
||||||
|
stickState.rightY = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -127,6 +142,7 @@ Window {
|
||||||
id: stickState
|
id: stickState
|
||||||
property real leftX: 0
|
property real leftX: 0
|
||||||
property real leftY: 0
|
property real leftY: 0
|
||||||
|
property real rightY: 0
|
||||||
readonly property real deadzone: 0.4
|
readonly property real deadzone: 0.4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,6 +180,32 @@ Window {
|
||||||
onTriggered: root.navigateByStick()
|
onTriggered: root.navigateByStick()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Right stick: smooth scroll the grid view
|
||||||
|
Timer {
|
||||||
|
id: stickScrollTimer
|
||||||
|
interval: 16 // ~60 Hz for smooth scrolling
|
||||||
|
repeat: true
|
||||||
|
running: root.visible && Math.abs(stickState.rightY) > stickState.deadzone
|
||||||
|
onTriggered: {
|
||||||
|
// Scale scroll speed with deflection, max ~12px per frame
|
||||||
|
grid.contentY = Math.max(grid.originY,
|
||||||
|
Math.min(grid.contentY + stickState.rightY * 12,
|
||||||
|
grid.contentHeight - grid.height))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cycle through source filter tabs (All → Steam → Desktop → All …)
|
||||||
|
readonly property var _sourceFilters: ["", "steam", "desktop"]
|
||||||
|
function cycleSourceFilter(direction) {
|
||||||
|
var current = _sourceFilters.indexOf(
|
||||||
|
GamingShell.GameLauncherProvider.sourceFilter)
|
||||||
|
if (current < 0) current = 0
|
||||||
|
var next = (current + direction + _sourceFilters.length)
|
||||||
|
% _sourceFilters.length
|
||||||
|
GamingShell.GameLauncherProvider.sourceFilter = _sourceFilters[next]
|
||||||
|
sourceFilterBar.currentIndex = next
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Kirigami.Theme.inherit: false
|
Kirigami.Theme.inherit: false
|
||||||
|
|
@ -525,7 +567,7 @@ Window {
|
||||||
|
|
||||||
// Gamepad legend
|
// Gamepad legend
|
||||||
PC3.Label {
|
PC3.Label {
|
||||||
text: i18n("A: Select B: Back Y: Exit")
|
text: i18n("A: Select B: Back Y: Exit LB/RB: Filter ☰: Search")
|
||||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.75
|
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.75
|
||||||
opacity: 0.5
|
opacity: 0.5
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue