Created
February 5, 2023 16:33
-
-
Save gatopeich/8770b1c4ef96cb8d576fbf03bee0c355 to your computer and use it in GitHub Desktop.
Sample gamepad configuration Xorg with hints to use as Mouse+Keyboard for Minecraft
This file contains 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
# Gamepad configuration for general use, and emulating mouse+keys for Minecraft | |
Section "InputClass" | |
Identifier "Gamepads" | |
Driver "joystick" | |
MatchIsJoystick "on" | |
#MatchDevicePath "/dev/input/js*" | |
#MatchProduct "GAME" | |
# Map arrow pad (axis 5 & 6) to cursor keys left right up down | |
Option "MapAxis5" "keylow=113 keyhigh=114" | |
Option "MapAxis6" "keylow=111 keyhigh=116" | |
Option "AutoRepeat" "0 0" | |
# Map buttons to mouse left, Q, mouse right, E, ... | |
# On my PSX-style gamepad they are Square, Cross, Circle, Triangle, L, R, Select, Start | |
# On Minecraft I want L-Click (Attack), drop, R-click (Use), Inventory, Sneak, Jump, Sprint, Enter, | |
# 9=Select=Esc, START=F5, 11=L3=Pick, 12=R3=Emote, 13 = HOME | |
# OLD: Option "ButtonMapping" "1 24 3 26 50 65 37 36 9 71 2 45 110" | |
Option "MapButton1" "button=1" # L-Click ~ Attack | |
Option "MapButton2" "key=24" # Q ~ drop | |
Option "MapButton3" "button=3" # R-Click ~ Use | |
Option "MapButton4" "key=26" # E ~ Inventory | |
Option "MapButton5" "key=50" # Shift ~ Sneak | |
Option "MapButton6" "key=65" # Space ~ Jump | |
Option "MapButton7" "key=37" # Control_L ~ Sprint | |
Option "MapButton8" "key=36" # Enter | |
Option "MapButton9" "key=9" # Escape | |
Option "MapButton10" "key=71" # F5 ~ Toggle Perspective | |
Option "MapButton11" "button=2" # Middle-click ~ Pick block | |
Option "MapButton12" "key=45" # K ~ Emote | |
Option "MapButton13" "key=110" # Home key | |
EndSection | |
# Relevant keycodes scanned with | |
#$ xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p' | |
# 1 => mouse 1 ~ Attack | |
# 24 q => Drop item mapped to PSX Cross | |
# 3 => mouse 3 ~ Use | |
# 26 e => Inventory mapped to PSX Triangle | |
# 50 Shift_L ~ Sneak | |
# 65 space ~ Jump | |
# 37 Control_L ~ Sprint | |
# 36 Return | |
# 9 Esc | |
# 71 F5 => Toggle Perspective | |
# 2 => Mouse middle ~ Pick block | |
# 56 b ~ Emote | |
# 25 w | |
# 38 a | |
# 39 s | |
# 40 d | |
# 53 x | |
# 45 k | |
# 62 Shift_R | |
# 110 Home | |
# 64 Alt_L | |
# 111 Up | |
# 116 Down | |
# 113 Left | |
# 114 Right |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And this is the output of xinput list-props after loading with that configuration, which could be used to enable the same mappings via xinput command line...