Repository navigation
Learn gamepad buttons 1 to 8 as switch keys - #1223
Merged
Merged
Conversation
Switch interfaces in gamepad mode (Joycable, Pretorian USB Switch, Crick USB Switch Box, Ultimate Switchbox) and game controllers such as the Xbox Adaptive Controller present as HID game controllers and send numbered buttons. Buttons 1 to 8 on any connected controller are now switch keys named Gamepad1 to Gamepad8, learned and used like keyboard keys. Windows registers the joystick and gamepad usages with Raw Input in the capture worker, so presses arrive in the background, and reads button state through the HID parser. macOS reads the same reports through IOHIDManager on the capture run loop; the GameController framework's background flag is not relied on. Buttons are never suppressed, a held button blocks re-enabling until released, and a removed controller releases its buttons. The synced settings schema moves to 6 so an older Switchify PC asks for an update instead of refusing the switches. Closes #1222 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…n macOS Windows now records controllers on arrival and at startup, so unplugging one that never reported is a controller removal and cannot send keyboard capture into recovery. The button usage list is sized from the device. macOS counts a button held while capture was off as held on begin, like a key. Held-key messages use the badge wording "Gamepad 1". The docs qualify the Xbox Adaptive Controller as checked on Windows. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The keyboard hook rejects virtual-key codes in the controller range, so a keyboard reporting an unassigned code can never be learned or suppressed as a button. The shutdown-wait message names held buttons the way the badges do. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A keyboard reporting an unassigned code in the controller range leaves no observation, so it can never read as a lost hook. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
enaboapps
marked this pull request as ready for review
October 28, 2026 09:37
This was referenced Oct 28, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1222
What
Switch interfaces in gamepad mode and game controllers now work as switches. Buttons 1 to 8 on any connected controller are switch keys named
Gamepad1toGamepad8, shown as Gamepad 1 to Gamepad 8, learned from the Switches page like keys and usable for every press and hold action.RIDEV_INPUTSINK), so presses arrive while another app is in front, and reads button state withHidP_GetUsages. Button edges ride the existing edge queue at virtual-key codes Windows leaves unassigned (0x97 to 0x9E); the keyboard hook ignores that range so a stray keyboard code can never pose as a button. Controllers are recorded on arrival and at startup so unplugging one is never mistaken for a keyboard removal. Buttons are never suppressed, a held button blocks re-enabling until released, a removed controller releases its buttons, and controller registration is best effort so keyboard capture never depends on it.IOHIDManagerscheduled on the existing capture run loop, matching the same usages and only button elements. GameController's background flag is not used (it broke silently in macOS 15.4). A button held while capture was off blocks re-enabling, like a key.Out of scope, as in the issue: sticks, triggers, the D-pad, Xbox layout names, buttons 9 and up, and telling two controllers apart.
Validation
npm run prediction-model,npm run lint,npm test(312 passed),npm run buildcargo fmt --check,cargo clippy --all-targets -D warningson Windows and cross-checked foraarch64-apple-darwin,cargo test(849 passed)site:npm run buildNot yet done, needs hardware: a controller or switch box in gamepad mode on Windows and on a Mac, learned while another app is in front. The Xbox Adaptive Controller should be checked over USB and Bluetooth since its two transports expose different descriptors, and a composite box such as the Pretorian USB Switch should be checked on a Mac in case Input Monitoring is required. Known limits accepted for now: a button held across a worker restart on Windows is not known until its next report, and a controller that splits its buttons across several HID report IDs would need per-report tracking.
🤖 Generated with Claude Code