Modding:Player Guide/Key Bindings
Some mods let you edit key bindings, which are controller/keyboard/mouse buttons which do something in-game. This page explains how to configure them. (This works for any mod using SMAPI's standard APIs.)
Configure a mod's bindings
- Install the mod (see player guide).
- Run SMAPI at least once with the mod to let it generate its config file.
- Edit config.json in the mod's folder with a text editor.
- Change the key options using the values below. (On macOS, make sure it doesn't change to curly quotes.)
Note that some mods may not be configurable.
Disable a mod's key binding
You can use "None" to disable a key binding.
Find the code for a key
Button codes below shows all available codes, but sometimes it's not clear which one applies (e.g., for non-English keyboards). Here's how to check:
- Launch the game.
- In the SMAPI console window, enter the test_input command.
- In the game, press the keys you want to test.
- The SMAPI console will list the codes for the keys it received.
Use key bindings on Android
You can bind physical mobile buttons, but there aren't many available. SMAPI on Android includes a Virtual Keyboard mod which lets you add on-screen buttons you can tap to send keyboard input to your installed mods.
To use the virtual keyboard:
- In-game, a keyboard icon should appear in the top-left corner of the screen.
- Tap the keyboard icon to show the configured buttons.
- Tap the button to send.
To add a new key:
- Run the game once to generate the default config.json file.
- Open the Mods/VirtualKeyboard/config.json file in a text editor.
- Add new buttons to the buttons field in the same format.
Tip: when you add a button, set its X value to the previous button + 96.
- common keys
value description A through Z The letter keys. D0 through D9 The number keys. Down, Left,
The arrow keys. F1 through F24 The function keys. Apps The applications or menu () key, typically located next to your right key. Back The backspace (or ) key. CapsLock Theor key. Enter Theor key. Escape Thekey. LeftAlt, RightAlt Thekeys. LeftControl, RightControl Thekeys. LeftShift, RightShift Theor keys. LeftWindows, RightWindows The Windows keys. OemCloseBrackets Thekey. OemComma Thekey. OemMinus Thekey. OemOpenBrackets Thekey. OemPeriod Thekey. OemPipe Thekey. OemPlus Thekey. OemQuestion Thekey on a US standard keyboard. OemQuotes Theor key on a US standard keyboard. OemSemicolon Thekey on a US standard keyboard. OemTilde Thekey on a US standard keyboard. Space The space bar. Tab Thekey.
- numeric pad
value description Numpad0 through Numpad9 The numpad number keys. Add Thenumpad key. Subtract Thenumpad key. Divide Thenumpad key. Multiply Thenumpad key. NumLock The numeric lock,, , or key.
- control keys (above arrow keys)
value description Delete Thekey. End Thekey. Insert Thekey. PageDown, PageUp Theand keys. Pause Thekey. PrintScreen Thekey. Scroll Thekey.
- uncommon keys
value description BrowserBack The browser back key. BrowserFavorites The browser favorites key. BrowserForward The browser forward key. BrowserHome The browser start and home key. BrowserRefresh The browser refresh key. BrowserSearch The browser search key. BrowserStop The browser stop key. ChatPadGreen The green ChatPad key. ChatPadOrange The orange ChatPad key. Crsel The cursor select key. Decimal The decimal key. EraseEof The erase EOF key. Execute The execute key. Exsel The execute selection key. Help The help key. Home The home key. ImeConvert The IME convert key. ImeNoConvert The IME no-convert key. Kana The Kana key on Japanese keyboards. Kanji The Kanji key on Japanese keyboards. LaunchApplication1 The Start Application 1 key. LaunchApplication2 The Start Application 2 key. LaunchMail The Start Mail key. MediaNextTrack The Next Track key. MediaPlayPause The Play/Pause Media key. MediaPreviousTrack The Previous Track key. MediaStop The Stop Media key. Oem8 Varies by keyboard. OemAuto OEM Auto key. OemBackslash The The OEM angle bracket or backslash key on the RT 102 key keyboard. OemClear The OEM clear key. OemCopy The OEM copy key. OemEnlW The OEM Enlarge Window key. PA1 The PA1 key. Play The play key. Thekey. ProcessKey The IME process key. Select The select key. SelectMedia The select media key. Separator The separator key. Sleep The computer sleep key. VolumeDown, VolumeUp The volume down/up keys. VolumeMute The volume mute keys. Zoom The zoom key.
|The main buttons.|
|ControllerBack||The 'BACK' button on an XBox controller.|
|ControllerStart||The 'START' button.|
|BigButton||The 'big button' on the XBox Big Button controller.|
|The directional pad buttons.|
|LeftShoulder, RightShoulder||The bumper (shoulder) buttons.|
|LeftTrigger, RightTrigger||The trigger buttons.|
|LeftStick, RightStick||The left/right thumbsticks when clicked or pressed as a button.|
|The left thumbstick when pushed in a direction.|
|The right thumbstick when pushed in a direction.|
|MouseLeft||The left mouse button.|
|MouseRight||The right mouse button.|
|MouseMiddle||The middle mouse button.|
|MouseX1, MouseX2||The extended mouse buttons (varies by mouse).|
|VolumeUp, VolumeDown||The volume up/down buttons.|
The Steam deck is mapped as a controller (see controller codes), and you can remap buttons using Steam Input. Here's how the different Steam Deck buttons are mapped by default:
|A, B, X, Y
left/right trigger buttons
|Sends the equivalent controller codes.|
|left touchpad||Sends equivalent D-Pad codes when touching the edges (e.g. left edge is DPadLeft).|
|right touchpad||Sends right thumbstick codes.|
|'Back grip' buttons (L4, L5, R4, R5)||Not sent to the game by default, unless mapped to a key in Steam Input.|
|Not sent to the game.|
You can also rebind physical keys in the Steam Deck settings:
- Go to Controller Settings > Edit Layout.
- Choose the button to rebind.
- Choose Command Page > Keyboard.
- Choose the keyboard button to bind it to.
- Now when you press that physical button in-game, it'll send the new keyboard code instead.
Mods using SMAPI 3.9+ features can support multi-key bindings. That lets you combine multiple button codes into a combo keybind, and list alternate keybinds. For example,
"LeftShoulder, LeftControl + S" will apply if LeftShoulder is pressed, or if both LeftControl and S are pressed.
Some things to keep in mind:
- The order doesn't matter, so
"LeftControl + S"and
"S + LeftControl"are equivalent.
- SMAPI doesn't prevent mods from using overlapping hotkeys. For example, if one mod uses
"S"and the other mod uses
"LeftControl + S", pressing LeftControl and S will activate both.