aboutsummaryrefslogtreecommitdiffstats
path: root/common/keymap.h
blob: e1a6f992e64cf47e0201790ddce1b8f069c6c06a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
Copyright 2011 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KEYMAP_H
#define KEYMAP_H

#include <stdint.h>
#include <stdbool.h>
#include "action.h"


#ifdef BOOTMAGIC_ENABLE
/* NOTE: Not portable. Bit field order depends on implementation */
typedef union {
    uint8_t raw;
    struct {
        bool swap_control_capslock:1;
        bool capslock_to_control:1;
        bool swap_lalt_lgui:1;
        bool swap_ralt_rgui:1;
        bool no_gui:1;
        bool swap_grave_esc:1;
        bool swap_backslash_backspace:1;
        bool nkro:1;
    };
} keymap_config_t;
keymap_config_t keymap_config;
#endif


/* translates key to keycode */
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key);

/* translates Fn keycode to action */
action_t keymap_fn_to_action(uint8_t keycode);



#ifdef USE_LEGACY_KEYMAP
/* 
 * Legacy keymap
 *      Consider using new keymap API above instead.
 */
/* keycode of key */
__attribute__ ((deprecated))
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col);

/* layer to move during press Fn key */
__attribute__ ((deprecated))
uint8_t keymap_fn_layer(uint8_t fn_bits);

/* keycode to send when release Fn key without using */
__attribute__ ((deprecated))
uint8_t keymap_fn_keycode(uint8_t fn_bits);
#endif

#endif
id='n397' href='#n397'>397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
# Keycodes Overview

When defining a [keymap](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.

This is a reference only. Each group of keys links to the page documenting their functionality in more detail.

## [Basic Keycodes](keycodes_basic.md)

|Key                    |Aliases             |Description                                    |
|-----------------------|--------------------|-----------------------------------------------|
|`KC_1`                 |                    |`1` and `!`                                    |
|`KC_2`                 |                    |`2` and `@`                                    |
|`KC_3`                 |                    |`3` and `#`                                    |
|`KC_4`                 |                    |`4` and `$`                                    |
|`KC_5`                 |                    |`5` and `%`                                    |
|`KC_6`                 |                    |`6` and `^`                                    |
|`KC_7`                 |                    |`7` and `&`                                    |
|`KC_8`                 |                    |`8` and `*`                                    |
|`KC_9`                 |                    |`9` and `(`                                    |
|`KC_0`                 |                    |`0` and `)`                                    |
|`KC_F1`                |                    |                                               |
|`KC_F2`                |                    |                                               |
|`KC_F3`                |                    |                                               |
|`KC_F4`                |                    |                                               |
|`KC_F5`                |                    |                                               |
|`KC_F6`                |                    |                                               |
|`KC_F7`                |                    |                                               |
|`KC_F8`                |                    |                                               |
|`KC_F9`                |                    |                                               |
|`KC_F10`               |                    |                                               |
|`KC_F11`               |                    |                                               |
|`KC_F12`               |                    |                                               |
|`KC_F13`               |                    |                                               |
|`KC_F14`               |                    |                                               |
|`KC_F15`               |                    |                                               |
|`KC_F16`               |                    |                                               |
|`KC_F17`               |                    |                                               |
|`KC_F18`               |                    |                                               |
|`KC_F19`               |                    |                                               |
|`KC_F20`               |                    |                                               |
|`KC_F21`               |                    |                                               |
|`KC_F22`               |                    |                                               |
|`KC_F23`               |                    |                                               |
|`KC_F24`               |                    |                                               |
|`KC_A`                 |                    |`a` and `A`                                    |
|`KC_B`                 |                    |`b` and `B`                                    |
|`KC_C`                 |                    |`c` and `C`                                    |
|`KC_D`                 |                    |`d` and `D`                                    |
|`KC_E`                 |                    |`e` and `E`                                    |
|`KC_F`                 |                    |`f` and `F`                                    |
|`KC_G`                 |                    |`g` and `G`                                    |
|`KC_H`                 |                    |`h` and `H`                                    |
|`KC_I`                 |                    |`i` and `I`                                    |
|`KC_J`                 |                    |`j` and `J`                                    |
|`KC_K`                 |                    |`k` and `K`                                    |
|`KC_L`                 |                    |`l` and `L`                                    |
|`KC_M`                 |                    |`m` and `M`                                    |
|`KC_N`                 |                    |`n` and `N`                                    |
|`KC_O`                 |                    |`o` and `O`                                    |
|`KC_P`                 |                    |`p` and `P`                                    |
|`KC_Q`                 |                    |`q` and `Q`                                    |
|`KC_R`                 |                    |`r` and `R`                                    |
|`KC_S`                 |                    |`s` and `S`                                    |
|`KC_T`                 |                    |`t` and `T`                                    |
|`KC_U`                 |                    |`u` and `U`                                    |
|`KC_V`                 |                    |`v` and `V`                                    |
|`KC_W`                 |                    |`w` and `W`                                    |
|`KC_X`                 |                    |`x` and `X`                                    |
|`KC_Y`                 |                    |`y` and `Y`                                    |
|`KC_Z`                 |                    |`z` and `Z`                                    |
|`KC_ENTER`             |`KC_ENT`            |Return (Enter)                                 |
|`KC_ESCAPE`            |`KC_ESC`            |Escape                                         |
|`KC_BSPACE`            |`KC_BSPC`           |Delete (Backspace)                             |
|`KC_TAB`               |                    |Tab                                            |
|`KC_SPACE`             |`KC_SPC`            |Spacebar                                       |
|`KC_MINUS`             |`KC_MINS`           |`-` and `_`                                    |
|`KC_EQUAL`             |`KC_EQL`            |`=` and `+`                                    |
|`KC_LBRACKET`          |`KC_LBRC`           |`[` and `{`                                    |
|`KC_RBRACKET`          |`KC_RBRC`           |`]` and `}`                                    |
|`KC_BSLASH`            |`KC_BSLS`           |`\` and <code>&#124;</code>                    |
|`KC_NONUS_HASH`        |`KC_NUHS`           |Non-US `#` and `~`                             |
|`KC_NONUS_BSLASH`      |`KC_NUBS`           |Non-US `\` and <code>&#124;</code>             |
|`KC_INT1`              |`KC_RO`             |JIS `\` and <code>&#124;</code>                |
|`KC_INT2`              |`KC_KANA`           |JIS Katakana/Hiragana                          |
|`KC_INT3`              |`KC_JYEN`           |JIS `¥`                                        |
|`KC_SCOLON`            |`KC_SCLN`           |`;` and `:`                                    |
|`KC_QUOTE`             |`KC_QUOT`           |`'` and `"`                                    |
|`KC_GRAVE`             |`KC_GRV`            |<code>&#96;</code> and `~`                     |
|`KC_COMMA`             |`KC_COMM`           |`,` and `<`                                    |
|`KC_DOT`               |                    |`.` and `>`                                    |
|`KC_SLASH`             |`KC_SLSH`           |`/` and `?`                                    |
|`KC_CAPSLOCK`          |`KC_CAPS`           |Caps Lock                                      |
|`KC_LCTRL`             |`KC_LCTL`           |Left Control                                   |
|`KC_LSHIFT`            |`KC_LSFT`           |Left Shift                                     |
|`KC_LALT`              |                    |Left Alt                                       |
|`KC_LGUI`              |`KC_LCMD`, `KC_LWIN`|Left GUI (Windows/Command/Meta key)            |
|`KC_RCTRL`             |`KC_RCTL`           |Right Control                                  |
|`KC_RSHIFT`            |`KC_RSFT`           |Right Shift                                    |
|`KC_RALT`              |                    |Right Alt                                      |
|`KC_RGUI`              |`KC_RCMD`, `KC_RWIN`|Right GUI (Windows/Command/Meta key)           |
|`KC_LOCKING_CAPS`      |`KC_LCAP`           |Locking Caps Lock                              |
|`KC_LOCKING_NUM`       |`KC_LNUM`           |Locking Num Lock                               |
|`KC_LOCKING_SCROLL`    |`KC_LSCR`           |Locking Scroll Lock                            |
|`KC_INT4`              |`KC_HENK`           |JIS Henkan                                     |
|`KC_INT5`              |`KC_MHEN`           |JIS Muhenkan                                   |
|`KC_PSCREEN`           |`KC_PSCR`           |Print Screen                                   |
|`KC_SCROLLLOCK`        |`KC_SLCK`           |Scroll Lock                                    |
|`KC_PAUSE`             |`KC_PAUS`           |Pause                                          |
|`KC_INSERT`            |`KC_INS`            |Insert                                         |
|`KC_HOME`              |                    |Home                                           |
|`KC_PGUP`              |                    |Page Up                                        |
|`KC_DELETE`            |`KC_DEL`            |Forward Delete                                 |
|`KC_END`               |                    |End                                            |
|`KC_PGDOWN`            |`KC_PGDN`           |Page Down                                      |
|`KC_RIGHT`             |`KC_RGHT`           |Right Arrow                                    |
|`KC_LEFT`              |                    |Left Arrow                                     |
|`KC_DOWN`              |                    |Down Arrow                                     |
|`KC_UP`                |                    |Up Arrow                                       |
|`KC_APPLICATION`       |`KC_APP`            |Application (Windows Menu Key)                 |
|`KC_POWER`             |                    |Deprecated by MS in favor of `KC_SYSTEM_POWER`.|
|`KC_EXECUTE`           |                    |Execute                                        |
|`KC_HELP`              |                    |Help                                           |
|`KC_MENU`              |                    |Menu                                           |
|`KC_SELECT`            |                    |Select                                         |
|`KC_AGAIN`             |                    |Again                                          |
|`KC_UNDO`              |                    |Undo                                           |
|`KC_CUT`               |                    |Cut                                            |
|`KC_COPY`              |                    |Copy                                           |
|`KC_PASTE`             |                    |Paste                                          |
|`KC_FIND`              |                    |Find                                           |
|`KC_ALT_ERASE`         |                    |Alternate Erase                                |
|`KC_SYSREQ`            |                    |SysReq/Attention                               |
|`KC_CANCEL`            |                    |Cancel                                         |
|`KC_CLEAR`             |                    |Clear                                          |
|`KC_PRIOR`             |                    |Prior                                          |
|`KC_RETURN`            |                    |Return                                         |
|`KC_SEPARATOR`         |                    |Separator                                      |
|`KC_OUT`               |                    |Out                                            |
|`KC_OPER`              |                    |Oper                                           |
|`KC_CLEAR_AGAIN`       |                    |Clear/Again                                    |
|`KC_CRSEL`             |                    |CrSel/Props                                    |