Skip to content

Keymaps

LTVA1 edited this page Jan 13, 2022 · 1 revision

Keymaps can be used to adjust the keyboard commands to match e.g. Protracker key commands.

Keymap presets are in key subdirectory in the program directory. The directory has a file for each preset, similarly to the theme/skin system.

NEWS: A tool for checking scancodes and keysyms

Format

The file has one shortcut mapping on each line:

<FROM> = <TO>

FROM and TO are combinations of modifiers (M_prefix) and keypresses (K_ or S_ prefix). Generally, Alt, Ctrl and Shift are to be used as modifiers when used in combination with other keys. If e.g. pressing just the right Ctrl does something, it has to be used as a key (K_RCTRL).

Note that you might have to use the specific modifier key like so (note how the left CTRL and shift keys are used instead of just M_CTRL and M_SHIFT):

M_LCTRL M_LSHIFT K_EQUALS = M_LCTRL M_LSHIFT K_KP_PLUS
M_LCTRL M_LSHIFT K_MINUS  = M_LCTRL M_LSHIFT K_KP_MINUS

S_ prefix is used to define keys by the scancode (use the above tool to find out scancodes). The format is as follows:

S_31 = K_x

This would map the key with the scancode 31 (hex) into X keypresses.

Hash (#) can be used for comments.

Valid key definitions can be found in keytab.c. E.g. KEYDEF(KP_DIVIDE) (keypad slash/divide) becomes K_KP_DIVIDE. MODDEF(LCTRL) (left Ctrl) becomes M_LCTRL.

Sections

The file is divided in sections so that shortcuts apply globally or to specific editors. The sections are marked as follows:

[global]
M_LCTRL K_Q = K_ESCAPE

[pattern]
M_LCTRL K_Q = K_SPACE

The above would map LeftCtrl-Q the same as pressing escape except in the pattern editor where it would be the same as pressing space bar. Valid sections are global, pattern, instrument and sequence.