🇪🇺🇪🇺🇪🇺Made in Europe🇪🇺🇪🇺🇪🇺
Keyboard keypresses translated into controller movements. Useful when coupled with emulators if you don't have a controller. Intended for Linux.
Currently supporting:
Xbox S Controller (XboxControllerS folder) - Finished
Xbox 360 Controller (XboxControllerS folder) - Untested
Other Xbox Controllers (XboxControllerS folder) - Untested
Playstation DualSense (PlaystationDualsense folder) - Untested
Xbox S Controller
ver18.py - lacks a few keys, rest is hard-coded
ver21.py - allows for loading custom keymap from whisk_keymap.conf, if not found - loads the hard-coded keys
Versions not included here are either unstable or lacking in features
Default Key Mappings: Keyboard / Mouse → Virtual Xbox Controller
Space -> Button A (uinput.BTN_A)
B -> Button B (uinput.BTN_B)
X -> Button X (uinput.BTN_X)
Y -> Button Y (uinput.BTN_Y)
Q -> Left Stick Click (uinput.BTN_THUMBL)
Z -> Right Stick Click (uinput.BTN_THUMBR)
E -> Left Bumper (uinput.BTN_TL)
R -> Right Bumper (uinput.BTN_TR)
Enter -> Start Button (uinput.BTN_START)
Backspace -> Select Button (uinput.BTN_SELECT)
Arrow Up -> D-Pad Up (uinput.BTN_DPAD_UP)
Arrow Down -> D-Pad Down (uinput.BTN_DPAD_DOWN)
Arrow Left -> D-Pad Left (uinput.BTN_DPAD_LEFT)
Arrow Right -> D-Pad Right (uinput.BTN_DPAD_RIGHT)
Left Mouse Button -> Right Trigger (uinput.ABS_RZ) Analog trigger (0-255)
Middle Mouse Button -> Left Trigger (uinput.ABS_Z) Analog trigger (0-255)
F -> Guide Button (uinput.BTN_MODE) (Formerly mapped to Right Mouse Button)
1 -> Digital Left Trigger (uinput.BTN_TL2) May vary by system/uinput support
2 -> Digital Right Trigger (uinput.BTN_TR2) May vary by system/uinput support
W/S/A/D -> Left Stick X and Y axes. Uses uinput.ABS_X and uinput.ABS_Y.
- W = Y-axis: 0 (up)
- S = Y-axis: 255 (down)
- A = X-axis: 0 (left)
- D = X-axis: 255 (right)
When key released, axis returns to neutral 128
Mouse Movement (REL_X/REL_Y) -> Right Stick X and Y axes. Uses uinput.ABS_RX and uinput.ABS_RY. Sensitivity and smoothing are applied.
These key combinations control the behavior of the script itself, rather than directly mapping to controller buttons
V -> Cycle mouse sensitivity
N -> Toggle cursor lock (grab/ungrab X11 pointer)
Shift + Alt + P -> Toggle cursor centering
Shift + X + Q + S -> EMERGENCY SWITCH-OFF (quits script cleanly)
M -> Toggle mouse smoothing
H -> Show keybinding help
Ctrl + C -> Exit script (standard terminal interrupt)
Requirements:
Python (tested on 3.13)
Instructions:
- Make your venv:
python3 -m venv yourvenv - Activate the venv:
source yourvenv/bin/activate - Make sure you have requirements.txt in an accessible directory - you can get it in a Build folder (like XboxControllerS/Build).
Then run:
pip install -r requirements.txt - Keep the venv as long as you want to use my script. To activate it another time, run:
source yourvenv/bin/activate
For more, check out instructions.txt in any Build folder
Made and tested on latest Ubuntu version at the time of coding in Python venv. Used with Xemu, with success!
This was intended for playing Halo: Combat Evolved on Xemu, that is why the default buttons are currently tailored to that game. I couldn't find anything like this on Github, so here it is.
- Add other Xbox controllers
Done from roadmap - Added key customization from config file
- Added more keys (Xbox Controller S)