]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - Keycodes.md
Update book.json
[qmk_firmware.git] / Keycodes.md
index ba55dbdc190ea194d72d682f5e7b12886417828b..0c185716a9c9946de67bdc3f76da277ce331b7c7 100644 (file)
@@ -1,9 +1,21 @@
 # Overview
 
-When defining a [keymap](https://github.com/qmk/qmk_firmware/blob/master/doc/keymap.md) each key needs a valid key definition. This page documents the symbols that correspond to keyboard scan codes that are available to you in QMK. They can be used by themselves or in combination with one of the [many functions available](https://github.com/qmk/qmk_firmware/wiki#going-beyond-the-keycodes) to customize your board.
+When defining a [keymap](https://github.com/qmk/qmk_firmware/blob/master/doc/keymap.md) each key needs a valid key definition.
+
+This page documents the symbols that correspond to keycodes that are available to you in QMK.
+
+To customize your board, they can be used by themselves or as **action codes** in combination with one of the [many C macros](https://github.com/qmk/qmk_firmware/wiki#c-macros-for-action-code).
+
+The source of truth for these codes is [tmk_core/common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h) file in the qmk source code.
 
 # The Keycodes
 
+Keycodes in QMK are based on [HID Usage Keyboard/Keypad Page(0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) with following exceptions:
+
+* `KC_NO` = 0 for no action
+* `KC_TRNS` = 1 for layer transparency
+* internal special keycodes in the `0xA5-DF` range (tmk heritage).
+
 ## Letters and Numbers
 
 |KC_1|KC_2|KC_3|KC_4|KC_5|KC_6|KC_7|KC_8|
@@ -84,16 +96,12 @@ When defining a [keymap](https://github.com/qmk/qmk_firmware/blob/master/doc/key
 |KC_HELP||Help|
 |KC_MENU||Menu|
 |KC_SELECT||Select|
-|KC_STOP||Stop|
 |KC_AGAIN||Again|
 |KC_UNDO||Undo|
 |KC_CUT||Cut|
 |KC_COPY||Copy|
 |KC_PASTE||Paste|
 |KC_FIND||Find|
-|KC__MUTE||Mute|
-|KC__VOLUP||Volume Up|
-|KC__VOLDOWN||Volume Down|
 |KC_ALT_ERASE||Alternate Erase7|
 |KC_SYSREQ||SysReq/Attention1|
 |KC_CANCEL||Cancel|
@@ -109,14 +117,6 @@ When defining a [keymap](https://github.com/qmk/qmk_firmware/blob/master/doc/key
 |KC_SYSTEM_POWER|KC_PWR|System Power Down|
 |KC_SYSTEM_SLEEP|KC_SLEP|System Sleep|
 |KC_SYSTEM_WAKE|KC_WAKE|System Wake|
-|KC_AUDIO_MUTE|KC_MUTE||
-|KC_AUDIO_VOL_UP|KC_VOLU||
-|KC_AUDIO_VOL_DOWN|KC_VOLD||
-|KC_MEDIA_NEXT_TRACK|KC_MNXT||
-|KC_MEDIA_PREV_TRACK|KC_MPRV||
-|KC_MEDIA_STOP|KC_MSTP||
-|KC_MEDIA_PLAY_PAUSE|KC_MPLY||
-|KC_MEDIA_SELECT|KC_MSEL||
 |KC_MAIL|KC_MAIL||
 |KC_CALCULATOR|KC_CALC||
 |KC_MY_COMPUTER|KC_MYCM||
@@ -128,6 +128,27 @@ When defining a [keymap](https://github.com/qmk/qmk_firmware/blob/master/doc/key
 |KC_WWW_REFRESH|KC_WREF||
 |KC_WWW_FAVORITES|KC_WFAV||
 
+## Media Keys
+
+Windows and Mac use different key codes for next track and previous track. Make sure you choose the keycode that corresponds to your OS.
+
+|Long Name|Short Name|Description|
+|---------|----------|-----------|
+|KC_STOP||Stop|
+|KC__MUTE||Mute|
+|KC__VOLUP||Volume Up|
+|KC__VOLDOWN||Volume Down|
+|KC_AUDIO_MUTE|KC_MUTE||
+|KC_AUDIO_VOL_UP|KC_VOLU||
+|KC_AUDIO_VOL_DOWN|KC_VOLD||
+|KC_MEDIA_NEXT_TRACK|KC_MNXT|Next Track (Windows)|
+|KC_MEDIA_PREV_TRACK|KC_MPRV|Previous Track (Windows)|
+|KC_MEDIA_FAST_FORWARD|KC_MFFD|Next Track (macOS)|
+|KC_MEDIA_REWIND|KC_MRWD|Previous Track (macOS)|
+|KC_MEDIA_STOP|KC_MSTP||
+|KC_MEDIA_PLAY_PAUSE|KC_MPLY||
+|KC_MEDIA_SELECT|KC_MSEL||
+
 ## Numpad
 
 |Long Name|Short Name|Description|
@@ -178,4 +199,30 @@ When defining a [keymap](https://github.com/qmk/qmk_firmware/blob/master/doc/key
 |KC_MS_WH_RIGHT|KC_WH_R|Mouse Wheel Right|
 |KC_MS_ACCEL0|KC_ACL0|Mouse Acceleration 0|
 |KC_MS_ACCEL1|KC_ACL1|Mouse Acceleration 1|
-|KC_MS_ACCEL2|KC_ACL2|Mouse Acceleration 2|
\ No newline at end of file
+|KC_MS_ACCEL2|KC_ACL2|Mouse Acceleration 2|
+
+## Magic Keys
+
+The following keys can be used to turn on and off various "Magic" features. These include Boot Magic (holding certain keys down while plugging the keyboard in) and the Magic Key.
+
+|Long Name|Short Name|Description|
+|---------|----------|-----------|
+|MAGIC_SWAP_CONTROL_CAPSLOCK||Swap Capslock and Control|
+|MAGIC_CAPSLOCK_TO_CONTROL||Change Capslock to Control|
+|MAGIC_SWAP_ALT_GUI||Swap ALT and GUI|
+|MAGIC_SWAP_LALT_LGUI||Swap LALT and LGUI|
+|MAGIC_SWAP_RALT_RGUI||Swap RALT and RGUI|
+|MAGIC_NO_GUI||Disable off the GUI key|
+|MAGIC_SWAP_GRAVE_ESC||Swap the GRAVE (~ `) and Esc keys|
+|MAGIC_SWAP_BACKSLASH_BACKSPACE||Swap Backslash and Backspace|
+|MAGIC_UNSWAP_CONTROL_CAPSLOCK||Disable the Control/Caps Swap|
+|MAGIC_UNCAPSLOCK_TO_CONTROL||Turn Capslock back into Capslock|
+|MAGIC_UNSWAP_ALT_GUI||Turn the ALT/GUI swap off|
+|MAGIC_UNSWAP_LALT_LGUI||Turn the LALT/LGUI swap off|
+|MAGIC_UNSWAP_RALT_RGUI||Turn the RALT/RGUI swap off|
+|MAGIC_UNNO_GUI||Enable the GUI key|
+|MAGIC_UNSWAP_GRAVE_ESC||Turn the GRAVE/ESC swap off|
+|MAGIC_UNSWAP_BACKSLASH_BACKSPACE||Turn the Backslash/Backspace swap off|
+|MAGIC_HOST_NKRO||Turn NKRO on|
+|MAGIC_UNHOST_NKRO||Turn NKRO off|
+|MAGIC_TOGGLE_NKRO||Toggle NKRO on or off|
\ No newline at end of file