qmk

QMK Firmware
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

quantum_keycodes.h (17985B)


      1 /* Copyright 2016-2017 Jack Humbert
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 2 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15  */
     16 #ifndef QUANTUM_KEYCODES_H
     17 #define QUANTUM_KEYCODES_H
     18 
     19 #ifndef MIDI_ENABLE_STRICT
     20 #    define MIDI_ENABLE_STRICT 0
     21 #endif
     22 
     23 #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
     24 #    ifndef MIDI_TONE_KEYCODE_OCTAVES
     25 #        define MIDI_TONE_KEYCODE_OCTAVES 3
     26 #    endif
     27 #endif
     28 
     29 // Fillers to make layering more clear
     30 #define _______ KC_TRNS
     31 #define XXXXXXX KC_NO
     32 
     33 enum quantum_keycodes {
     34     // Ranges used in shortcuts - not to be used directly
     35     QK_BASIC                = 0x0000,
     36     QK_BASIC_MAX            = 0x00FF,
     37     QK_MODS                 = 0x0100,
     38     QK_LCTL                 = 0x0100,
     39     QK_LSFT                 = 0x0200,
     40     QK_LALT                 = 0x0400,
     41     QK_LGUI                 = 0x0800,
     42     QK_RMODS_MIN            = 0x1000,
     43     QK_RCTL                 = 0x1100,
     44     QK_RSFT                 = 0x1200,
     45     QK_RALT                 = 0x1400,
     46     QK_RGUI                 = 0x1800,
     47     QK_MODS_MAX             = 0x1FFF,
     48     QK_FUNCTION             = 0x2000,
     49     QK_FUNCTION_MAX         = 0x2FFF,
     50     QK_MACRO                = 0x3000,
     51     QK_MACRO_MAX            = 0x3FFF,
     52     QK_LAYER_TAP            = 0x4000,
     53     QK_LAYER_TAP_MAX        = 0x4FFF,
     54     QK_TO                   = 0x5000,
     55     QK_TO_MAX               = 0x50FF,
     56     QK_MOMENTARY            = 0x5100,
     57     QK_MOMENTARY_MAX        = 0x51FF,
     58     QK_DEF_LAYER            = 0x5200,
     59     QK_DEF_LAYER_MAX        = 0x52FF,
     60     QK_TOGGLE_LAYER         = 0x5300,
     61     QK_TOGGLE_LAYER_MAX     = 0x53FF,
     62     QK_ONE_SHOT_LAYER       = 0x5400,
     63     QK_ONE_SHOT_LAYER_MAX   = 0x54FF,
     64     QK_ONE_SHOT_MOD         = 0x5500,
     65     QK_ONE_SHOT_MOD_MAX     = 0x55FF,
     66     QK_TAP_DANCE            = 0x5700,
     67     QK_TAP_DANCE_MAX        = 0x57FF,
     68     QK_LAYER_TAP_TOGGLE     = 0x5800,
     69     QK_LAYER_TAP_TOGGLE_MAX = 0x58FF,
     70     QK_LAYER_MOD            = 0x5900,
     71     QK_LAYER_MOD_MAX        = 0x59FF,
     72 #ifdef STENO_ENABLE
     73     QK_STENO        = 0x5A00,
     74     QK_STENO_BOLT   = 0x5A30,
     75     QK_STENO_GEMINI = 0x5A31,
     76     QK_STENO_MAX    = 0x5A3F,
     77 #endif
     78 #ifdef SWAP_HANDS_ENABLE
     79     QK_SWAP_HANDS     = 0x5B00,
     80     QK_SWAP_HANDS_MAX = 0x5BFF,
     81 #endif
     82     QK_MOD_TAP     = 0x6000,
     83     QK_MOD_TAP_MAX = 0x7FFF,
     84 #ifdef UNICODE_ENABLE
     85     QK_UNICODE     = 0x8000,
     86     QK_UNICODE_MAX = 0xFFFF,
     87 #endif
     88 #ifdef UNICODEMAP_ENABLE
     89     QK_UNICODEMAP          = 0x8000,
     90     QK_UNICODEMAP_MAX      = 0xBFFF,
     91     QK_UNICODEMAP_PAIR     = 0xC000,
     92     QK_UNICODEMAP_PAIR_MAX = 0xFFFF,
     93 #endif
     94 
     95     // Loose keycodes - to be used directly
     96 
     97     RESET = 0x5C00,
     98     DEBUG,
     99     MAGIC_SWAP_CONTROL_CAPSLOCK,
    100     MAGIC_CAPSLOCK_TO_CONTROL,
    101     MAGIC_SWAP_LALT_LGUI,
    102     MAGIC_SWAP_RALT_RGUI,
    103     MAGIC_NO_GUI,
    104     MAGIC_SWAP_GRAVE_ESC,
    105     MAGIC_SWAP_BACKSLASH_BACKSPACE,
    106     MAGIC_HOST_NKRO,
    107     MAGIC_SWAP_ALT_GUI,
    108     MAGIC_UNSWAP_CONTROL_CAPSLOCK,
    109     MAGIC_UNCAPSLOCK_TO_CONTROL,
    110     MAGIC_UNSWAP_LALT_LGUI,
    111     MAGIC_UNSWAP_RALT_RGUI,
    112     MAGIC_UNNO_GUI,
    113     MAGIC_UNSWAP_GRAVE_ESC,
    114     MAGIC_UNSWAP_BACKSLASH_BACKSPACE,
    115     MAGIC_UNHOST_NKRO,
    116     MAGIC_UNSWAP_ALT_GUI,
    117     MAGIC_TOGGLE_NKRO,
    118     MAGIC_TOGGLE_ALT_GUI,
    119     GRAVE_ESC,
    120 
    121 // Leader key
    122 #ifdef LEADER_ENABLE
    123     KC_LEAD,
    124 #endif
    125 
    126     // Auto Shift setup
    127     KC_ASUP,
    128     KC_ASDN,
    129     KC_ASRP,
    130     KC_ASTG,
    131     KC_ASON,
    132     KC_ASOFF,
    133 
    134     // Audio on/off/toggle
    135     AU_ON,
    136     AU_OFF,
    137     AU_TOG,
    138 
    139     // Faux clicky as part of main audio feature
    140     CLICKY_TOGGLE,
    141     CLICKY_ENABLE,
    142     CLICKY_DISABLE,
    143     CLICKY_UP,
    144     CLICKY_DOWN,
    145     CLICKY_RESET,
    146 
    147 #ifdef FAUXCLICKY_ENABLE
    148     // Faux clicky
    149     FC_ON,
    150     FC_OFF,
    151     FC_TOG,
    152 #endif
    153 
    154     // Music mode on/off/toggle
    155     MU_ON,
    156     MU_OFF,
    157     MU_TOG,
    158 
    159     // Music mode cycle
    160     MU_MOD,
    161 
    162     // Music voice iterate
    163     MUV_IN,
    164     MUV_DE,
    165 
    166 // Midi
    167 #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
    168     MI_ON,
    169     MI_OFF,
    170     MI_TOG,
    171 #endif
    172 
    173 #if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
    174     MIDI_TONE_MIN,
    175 
    176 #    if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 0
    177     MI_C = MIDI_TONE_MIN,
    178     MI_Cs,
    179     MI_Db = MI_Cs,
    180     MI_D,
    181     MI_Ds,
    182     MI_Eb = MI_Ds,
    183     MI_E,
    184     MI_F,
    185     MI_Fs,
    186     MI_Gb = MI_Fs,
    187     MI_G,
    188     MI_Gs,
    189     MI_Ab = MI_Gs,
    190     MI_A,
    191     MI_As,
    192     MI_Bb = MI_As,
    193     MI_B,
    194 #    endif
    195 
    196 #    if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 1
    197     MI_C_1,
    198     MI_Cs_1,
    199     MI_Db_1 = MI_Cs_1,
    200     MI_D_1,
    201     MI_Ds_1,
    202     MI_Eb_1 = MI_Ds_1,
    203     MI_E_1,
    204     MI_F_1,
    205     MI_Fs_1,
    206     MI_Gb_1 = MI_Fs_1,
    207     MI_G_1,
    208     MI_Gs_1,
    209     MI_Ab_1 = MI_Gs_1,
    210     MI_A_1,
    211     MI_As_1,
    212     MI_Bb_1 = MI_As_1,
    213     MI_B_1,
    214 #    endif
    215 
    216 #    if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 2
    217     MI_C_2,
    218     MI_Cs_2,
    219     MI_Db_2 = MI_Cs_2,
    220     MI_D_2,
    221     MI_Ds_2,
    222     MI_Eb_2 = MI_Ds_2,
    223     MI_E_2,
    224     MI_F_2,
    225     MI_Fs_2,
    226     MI_Gb_2 = MI_Fs_2,
    227     MI_G_2,
    228     MI_Gs_2,
    229     MI_Ab_2 = MI_Gs_2,
    230     MI_A_2,
    231     MI_As_2,
    232     MI_Bb_2 = MI_As_2,
    233     MI_B_2,
    234 #    endif
    235 
    236 #    if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 3
    237     MI_C_3,
    238     MI_Cs_3,
    239     MI_Db_3 = MI_Cs_3,
    240     MI_D_3,
    241     MI_Ds_3,
    242     MI_Eb_3 = MI_Ds_3,
    243     MI_E_3,
    244     MI_F_3,
    245     MI_Fs_3,
    246     MI_Gb_3 = MI_Fs_3,
    247     MI_G_3,
    248     MI_Gs_3,
    249     MI_Ab_3 = MI_Gs_3,
    250     MI_A_3,
    251     MI_As_3,
    252     MI_Bb_3 = MI_As_3,
    253     MI_B_3,
    254 #    endif
    255 
    256 #    if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 4
    257     MI_C_4,
    258     MI_Cs_4,
    259     MI_Db_4 = MI_Cs_4,
    260     MI_D_4,
    261     MI_Ds_4,
    262     MI_Eb_4 = MI_Ds_4,
    263     MI_E_4,
    264     MI_F_4,
    265     MI_Fs_4,
    266     MI_Gb_4 = MI_Fs_4,
    267     MI_G_4,
    268     MI_Gs_4,
    269     MI_Ab_4 = MI_Gs_4,
    270     MI_A_4,
    271     MI_As_4,
    272     MI_Bb_4 = MI_As_4,
    273     MI_B_4,
    274 #    endif
    275 
    276 #    if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
    277     MI_C_5,
    278     MI_Cs_5,
    279     MI_Db_5 = MI_Cs_5,
    280     MI_D_5,
    281     MI_Ds_5,
    282     MI_Eb_5 = MI_Ds_5,
    283     MI_E_5,
    284     MI_F_5,
    285     MI_Fs_5,
    286     MI_Gb_5 = MI_Fs_5,
    287     MI_G_5,
    288     MI_Gs_5,
    289     MI_Ab_5 = MI_Gs_5,
    290     MI_A_5,
    291     MI_As_5,
    292     MI_Bb_5 = MI_As_5,
    293     MI_B_5,
    294 #    endif
    295 
    296 #    if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
    297     MIDI_TONE_MAX = MI_B_5,
    298 #    elif MIDI_TONE_KEYCODE_OCTAVES > 4
    299     MIDI_TONE_MAX = MI_B_4,
    300 #    elif MIDI_TONE_KEYCODE_OCTAVES > 3
    301     MIDI_TONE_MAX = MI_B_3,
    302 #    elif MIDI_TONE_KEYCODE_OCTAVES > 2
    303     MIDI_TONE_MAX = MI_B_2,
    304 #    elif MIDI_TONE_KEYCODE_OCTAVES > 1
    305     MIDI_TONE_MAX = MI_B_1,
    306 #    elif MIDI_TONE_KEYCODE_OCTAVES > 0
    307     MIDI_TONE_MAX = MI_B,
    308 #    endif
    309 
    310     MIDI_OCTAVE_MIN,
    311     MI_OCT_N2 = MIDI_OCTAVE_MIN,
    312     MI_OCT_N1,
    313     MI_OCT_0,
    314     MI_OCT_1,
    315     MI_OCT_2,
    316     MI_OCT_3,
    317     MI_OCT_4,
    318     MI_OCT_5,
    319     MI_OCT_6,
    320     MI_OCT_7,
    321     MIDI_OCTAVE_MAX = MI_OCT_7,
    322     MI_OCTD,  // octave down
    323     MI_OCTU,  // octave up
    324 
    325     MIDI_TRANSPOSE_MIN,
    326     MI_TRNS_N6 = MIDI_TRANSPOSE_MIN,
    327     MI_TRNS_N5,
    328     MI_TRNS_N4,
    329     MI_TRNS_N3,
    330     MI_TRNS_N2,
    331     MI_TRNS_N1,
    332     MI_TRNS_0,
    333     MI_TRNS_1,
    334     MI_TRNS_2,
    335     MI_TRNS_3,
    336     MI_TRNS_4,
    337     MI_TRNS_5,
    338     MI_TRNS_6,
    339     MIDI_TRANSPOSE_MAX = MI_TRNS_6,
    340     MI_TRNSD,  // transpose down
    341     MI_TRNSU,  // transpose up
    342 
    343     MIDI_VELOCITY_MIN,
    344     MI_VEL_1 = MIDI_VELOCITY_MIN,
    345     MI_VEL_2,
    346     MI_VEL_3,
    347     MI_VEL_4,
    348     MI_VEL_5,
    349     MI_VEL_6,
    350     MI_VEL_7,
    351     MI_VEL_8,
    352     MI_VEL_9,
    353     MI_VEL_10,
    354     MIDI_VELOCITY_MAX = MI_VEL_10,
    355     MI_VELD,  // velocity down
    356     MI_VELU,  // velocity up
    357 
    358     MIDI_CHANNEL_MIN,
    359     MI_CH1 = MIDI_CHANNEL_MIN,
    360     MI_CH2,
    361     MI_CH3,
    362     MI_CH4,
    363     MI_CH5,
    364     MI_CH6,
    365     MI_CH7,
    366     MI_CH8,
    367     MI_CH9,
    368     MI_CH10,
    369     MI_CH11,
    370     MI_CH12,
    371     MI_CH13,
    372     MI_CH14,
    373     MI_CH15,
    374     MI_CH16,
    375     MIDI_CHANNEL_MAX = MI_CH16,
    376     MI_CHD,  // previous channel
    377     MI_CHU,  // next channel
    378 
    379     MI_ALLOFF,  // all notes off
    380 
    381     MI_SUS,   // sustain
    382     MI_PORT,  // portamento
    383     MI_SOST,  // sostenuto
    384     MI_SOFT,  // soft pedal
    385     MI_LEG,   // legato
    386 
    387     MI_MOD,    // modulation
    388     MI_MODSD,  // decrease modulation speed
    389     MI_MODSU,  // increase modulation speed
    390 
    391     MI_BENDD,  // Bend down
    392     MI_BENDU,  // Bend up
    393 #endif         // MIDI_ADVANCED
    394 
    395     // Backlight functionality
    396     BL_ON,
    397     BL_OFF,
    398     BL_DEC,
    399     BL_INC,
    400     BL_TOGG,
    401     BL_STEP,
    402     BL_BRTG,
    403 
    404     // RGB functionality
    405     RGB_TOG,
    406     RGB_MODE_FORWARD,
    407     RGB_MODE_REVERSE,
    408     RGB_HUI,
    409     RGB_HUD,
    410     RGB_SAI,
    411     RGB_SAD,
    412     RGB_VAI,
    413     RGB_VAD,
    414     RGB_SPI,
    415     RGB_SPD,
    416     RGB_MODE_PLAIN,
    417     RGB_MODE_BREATHE,
    418     RGB_MODE_RAINBOW,
    419     RGB_MODE_SWIRL,
    420     RGB_MODE_SNAKE,
    421     RGB_MODE_KNIGHT,
    422     RGB_MODE_XMAS,
    423     RGB_MODE_GRADIENT,
    424     RGB_MODE_RGBTEST,
    425 
    426     // Momentum matching toggle
    427     VLK_TOG,
    428 
    429     // Left shift, open paren
    430     KC_LSPO,
    431 
    432     // Right shift, close paren
    433     KC_RSPC,
    434 
    435     // Shift, Enter
    436     KC_SFTENT,
    437 
    438     // Printing
    439     PRINT_ON,
    440     PRINT_OFF,
    441 
    442     // output selection
    443     OUT_AUTO,
    444     OUT_USB,
    445 #ifdef BLUETOOTH_ENABLE
    446     OUT_BT,
    447 #endif
    448 
    449 #ifdef KEY_LOCK_ENABLE
    450     KC_LOCK,
    451 #endif
    452 
    453 #ifdef TERMINAL_ENABLE
    454     TERM_ON,
    455     TERM_OFF,
    456 #endif
    457 
    458     EEPROM_RESET,
    459 
    460     UNICODE_MODE_FORWARD,
    461     UNICODE_MODE_REVERSE,
    462     UNICODE_MODE_OSX,
    463     UNICODE_MODE_LNX,
    464     UNICODE_MODE_WIN,
    465     UNICODE_MODE_BSD,
    466     UNICODE_MODE_WINC,
    467 
    468     HPT_ON,
    469     HPT_OFF,
    470     HPT_TOG,
    471     HPT_RST,
    472     HPT_FBK,
    473     HPT_BUZ,
    474     HPT_MODI,
    475     HPT_MODD,
    476     HPT_DWLI,
    477     HPT_DWLD,
    478 
    479     // Left control, open paren
    480     KC_LCPO,
    481 
    482     // Right control, close paren
    483     KC_RCPC,
    484 
    485     // Left control, open paren
    486     KC_LAPO,
    487 
    488     // Right control, close paren
    489     KC_RAPC,
    490 
    491     CMB_ON,
    492     CMB_OFF,
    493     CMB_TOG,
    494 
    495     MAGIC_SWAP_LCTL_LGUI,
    496     MAGIC_SWAP_RCTL_RGUI,
    497     MAGIC_UNSWAP_LCTL_LGUI,
    498     MAGIC_UNSWAP_RCTL_RGUI,
    499     MAGIC_SWAP_CTL_GUI,
    500     MAGIC_UNSWAP_CTL_GUI,
    501     MAGIC_TOGGLE_CTL_GUI,
    502 
    503     // always leave at the end
    504     SAFE_RANGE
    505 };
    506 
    507 // Ability to use mods in layouts
    508 #define LCTL(kc) (QK_LCTL | (kc))
    509 #define LSFT(kc) (QK_LSFT | (kc))
    510 #define LALT(kc) (QK_LALT | (kc))
    511 #define LGUI(kc) (QK_LGUI | (kc))
    512 #define LCMD(kc) LGUI(kc)
    513 #define LWIN(kc) LGUI(kc)
    514 #define RCTL(kc) (QK_RCTL | (kc))
    515 #define RSFT(kc) (QK_RSFT | (kc))
    516 #define RALT(kc) (QK_RALT | (kc))
    517 #define ALGR(kc) RALT(kc)
    518 #define RGUI(kc) (QK_RGUI | (kc))
    519 #define RCMD(kc) RGUI(kc)
    520 #define RWIN(kc) RGUI(kc)
    521 
    522 #define HYPR(kc) (QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI | (kc))
    523 #define MEH(kc) (QK_LCTL | QK_LSFT | QK_LALT | (kc))
    524 #define LCAG(kc) (QK_LCTL | QK_LALT | QK_LGUI | (kc))
    525 #define SGUI(kc) (QK_LGUI | QK_LSFT | (kc))
    526 #define SCMD(kc) SGUI(kc)
    527 #define SWIN(kc) SGUI(kc)
    528 #define LCA(kc) (QK_LCTL | QK_LALT | (kc))
    529 
    530 #define MOD_HYPR 0xF
    531 #define MOD_MEH 0x7
    532 
    533 // Aliases for shifted symbols
    534 // Each key has a 4-letter code, and some have longer aliases too.
    535 // While the long aliases are descriptive, the 4-letter codes
    536 // make for nicer grid layouts (everything lines up), and are
    537 // the preferred style for Quantum.
    538 #define KC_TILD LSFT(KC_GRV)  // ~
    539 #define KC_TILDE KC_TILD
    540 
    541 #define KC_EXLM LSFT(KC_1)  // !
    542 #define KC_EXCLAIM KC_EXLM
    543 
    544 #define KC_AT LSFT(KC_2)  // @
    545 
    546 #define KC_HASH LSFT(KC_3)  // #
    547 
    548 #define KC_DLR LSFT(KC_4)  // $
    549 #define KC_DOLLAR KC_DLR
    550 
    551 #define KC_PERC LSFT(KC_5)  // %
    552 #define KC_PERCENT KC_PERC
    553 
    554 #define KC_CIRC LSFT(KC_6)  // ^
    555 #define KC_CIRCUMFLEX KC_CIRC
    556 
    557 #define KC_AMPR LSFT(KC_7)  // &
    558 #define KC_AMPERSAND KC_AMPR
    559 
    560 #define KC_ASTR LSFT(KC_8)  // *
    561 #define KC_ASTERISK KC_ASTR
    562 
    563 #define KC_LPRN LSFT(KC_9)  // (
    564 #define KC_LEFT_PAREN KC_LPRN
    565 
    566 #define KC_RPRN LSFT(KC_0)  // )
    567 #define KC_RIGHT_PAREN KC_RPRN
    568 
    569 #define KC_UNDS LSFT(KC_MINS)  // _
    570 #define KC_UNDERSCORE KC_UNDS
    571 
    572 #define KC_PLUS LSFT(KC_EQL)  // +
    573 
    574 #define KC_LCBR LSFT(KC_LBRC)  // {
    575 #define KC_LEFT_CURLY_BRACE KC_LCBR
    576 
    577 #define KC_RCBR LSFT(KC_RBRC)  // }
    578 #define KC_RIGHT_CURLY_BRACE KC_RCBR
    579 
    580 #define KC_LABK LSFT(KC_COMM)  // <
    581 #define KC_LEFT_ANGLE_BRACKET KC_LABK
    582 
    583 #define KC_RABK LSFT(KC_DOT)  // >
    584 #define KC_RIGHT_ANGLE_BRACKET KC_RABK
    585 
    586 #define KC_COLN LSFT(KC_SCLN)  // :
    587 #define KC_COLON KC_COLN
    588 
    589 #define KC_PIPE LSFT(KC_BSLS)  // |
    590 
    591 #define KC_LT LSFT(KC_COMM)  // <
    592 
    593 #define KC_GT LSFT(KC_DOT)  // >
    594 
    595 #define KC_QUES LSFT(KC_SLSH)  // ?
    596 #define KC_QUESTION KC_QUES
    597 
    598 #define KC_DQT LSFT(KC_QUOT)  // "
    599 #define KC_DOUBLE_QUOTE KC_DQT
    600 #define KC_DQUO KC_DQT
    601 
    602 #define KC_DELT KC_DELETE  // Del key (four letter code)
    603 
    604 // Alias for function layers than expand past FN31
    605 #define FUNC(kc) (QK_FUNCTION | (kc))
    606 
    607 // Aliases
    608 #define C(kc) LCTL(kc)
    609 #define S(kc) LSFT(kc)
    610 #define A(kc) LALT(kc)
    611 #define G(kc) LGUI(kc)
    612 
    613 #define F(kc) FUNC(kc)
    614 #define M(kc) (QK_MACRO | (kc))
    615 
    616 #define MACROTAP(kc) (QK_MACRO | (FUNC_TAP << 8) | (kc))
    617 #define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE)
    618 
    619 #define KC_GESC GRAVE_ESC
    620 
    621 #define EEP_RST EEPROM_RESET
    622 
    623 #define CK_TOGG CLICKY_TOGGLE
    624 #define CK_RST CLICKY_RESET
    625 #define CK_UP CLICKY_UP
    626 #define CK_DOWN CLICKY_DOWN
    627 #define CK_ON CLICKY_ENABLE
    628 #define CK_OFF CLICKY_DISABLE
    629 
    630 #define RGB_MOD RGB_MODE_FORWARD
    631 #define RGB_RMOD RGB_MODE_REVERSE
    632 
    633 #define RGB_M_P RGB_MODE_PLAIN
    634 #define RGB_M_B RGB_MODE_BREATHE
    635 #define RGB_M_R RGB_MODE_RAINBOW
    636 #define RGB_M_SW RGB_MODE_SWIRL
    637 #define RGB_M_SN RGB_MODE_SNAKE
    638 #define RGB_M_K RGB_MODE_KNIGHT
    639 #define RGB_M_X RGB_MODE_XMAS
    640 #define RGB_M_G RGB_MODE_GRADIENT
    641 #define RGB_M_T RGB_MODE_RGBTEST
    642 
    643 // L-ayer, T-ap - 256 keycode max, 16 layer max
    644 #define LT(layer, kc) (QK_LAYER_TAP | (((layer)&0xF) << 8) | ((kc)&0xFF))
    645 
    646 #define AG_SWAP MAGIC_SWAP_ALT_GUI
    647 #define AG_NORM MAGIC_UNSWAP_ALT_GUI
    648 #define AG_TOGG MAGIC_TOGGLE_ALT_GUI
    649 
    650 #define CG_SWAP MAGIC_SWAP_CTL_GUI
    651 #define CG_NORM MAGIC_UNSWAP_CTL_GUI
    652 #define CG_TOGG MAGIC_TOGGLE_CTL_GUI
    653 
    654 // GOTO layer - 16 layers max
    655 // when:
    656 // ON_PRESS    = 1
    657 // ON_RELEASE  = 2
    658 // Unless you have a good reason not to do so, prefer  ON_PRESS (1) as your default.
    659 // In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own
    660 // keycode modeled after the old version, kept below for this.
    661 /* #define TO(layer, when) (QK_TO | (when << 0x4) | (layer & 0xFF)) */
    662 #define TO(layer) (QK_TO | (ON_PRESS << 0x4) | ((layer)&0xFF))
    663 
    664 // Momentary switch layer - 256 layer max
    665 #define MO(layer) (QK_MOMENTARY | ((layer)&0xFF))
    666 
    667 // Set default layer - 256 layer max
    668 #define DF(layer) (QK_DEF_LAYER | ((layer)&0xFF))
    669 
    670 // Toggle to layer - 256 layer max
    671 #define TG(layer) (QK_TOGGLE_LAYER | ((layer)&0xFF))
    672 
    673 // One-shot layer - 256 layer max
    674 #define OSL(layer) (QK_ONE_SHOT_LAYER | ((layer)&0xFF))
    675 
    676 // L-ayer M-od: Momentary switch layer with modifiers active - 16 layer max, left mods only
    677 #define LM(layer, mod) (QK_LAYER_MOD | (((layer)&0xF) << 4) | ((mod)&0xF))
    678 
    679 // One-shot mod
    680 #define OSM(mod) (QK_ONE_SHOT_MOD | ((mod)&0xFF))
    681 
    682 // Layer tap-toggle
    683 #define TT(layer) (QK_LAYER_TAP_TOGGLE | ((layer)&0xFF))
    684 
    685 // M-od, T-ap - 256 keycode max
    686 #define MT(mod, kc) (QK_MOD_TAP | (((mod)&0x1F) << 8) | ((kc)&0xFF))
    687 
    688 #define LCTL_T(kc) MT(MOD_LCTL, kc)
    689 #define RCTL_T(kc) MT(MOD_RCTL, kc)
    690 #define CTL_T(kc) LCTL_T(kc)
    691 
    692 #define LSFT_T(kc) MT(MOD_LSFT, kc)
    693 #define RSFT_T(kc) MT(MOD_RSFT, kc)
    694 #define SFT_T(kc) LSFT_T(kc)
    695 
    696 #define LALT_T(kc) MT(MOD_LALT, kc)
    697 #define RALT_T(kc) MT(MOD_RALT, kc)
    698 #define ALT_T(kc) LALT_T(kc)
    699 #define ALGR_T(kc) RALT_T(kc)
    700 
    701 #define LGUI_T(kc) MT(MOD_LGUI, kc)
    702 #define RGUI_T(kc) MT(MOD_RGUI, kc)
    703 #define LCMD_T(kc) LGUI_T(kc)
    704 #define LWIN_T(kc) LGUI_T(kc)
    705 #define RCMD_T(kc) RGUI_T(kc)
    706 #define RWIN_T(kc) RGUI_T(kc)
    707 #define GUI_T(kc) LGUI_T(kc)
    708 #define CMD_T(kc) LCMD_T(kc)
    709 #define WIN_T(kc) LWIN_T(kc)
    710 
    711 #define C_S_T(kc) MT(MOD_LCTL | MOD_LSFT, kc)                         // Left Control + Shift e.g. for gnome-terminal
    712 #define MEH_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT, kc)              // Meh is a less hyper version of the Hyper key -- doesn't include GUI, so just Left Control + Shift + Alt
    713 #define LCAG_T(kc) MT(MOD_LCTL | MOD_LALT | MOD_LGUI, kc)             // Left Control + Alt + GUI
    714 #define RCAG_T(kc) MT(MOD_RCTL | MOD_RALT | MOD_RGUI, kc)             // Right Control + Alt + GUI
    715 #define HYPR_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI, kc)  // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/
    716 #define SGUI_T(kc) MT(MOD_LGUI | MOD_LSFT, kc)                        // Left Shift + GUI
    717 #define SCMD_T(kc) SGUI_T(kc)
    718 #define SWIN_T(kc) SGUI_T(kc)
    719 #define LCA_T(kc) MT(MOD_LCTL | MOD_LALT, kc)  // Left Control + Alt
    720 #define ALL_T(kc) HYPR_T(kc)
    721 
    722 // Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap
    723 #define KC_HYPR HYPR(KC_NO)
    724 #define KC_MEH MEH(KC_NO)
    725 
    726 #ifdef UNICODE_ENABLE
    727 // Allows Unicode input up to 0x7FFF
    728 #    define UC(c) (QK_UNICODE | (c))
    729 #endif
    730 #ifdef UNICODEMAP_ENABLE
    731 // Allows Unicode input up to 0x10FFFF, requires unicode_map
    732 #    define X(i) (QK_UNICODEMAP | (i))
    733 #    define XP(i, j) (QK_UNICODEMAP_PAIR | ((i)&0x7F) | (((j)&0x7F) << 7))  // 127 max i and j
    734 #endif
    735 
    736 #define UC_MOD UNICODE_MODE_FORWARD
    737 #define UC_RMOD UNICODE_MODE_REVERSE
    738 
    739 #define UC_M_OS UNICODE_MODE_OSX
    740 #define UC_M_LN UNICODE_MODE_LNX
    741 #define UC_M_WI UNICODE_MODE_WIN
    742 #define UC_M_BS UNICODE_MODE_BSD
    743 #define UC_M_WC UNICODE_MODE_WINC
    744 
    745 #ifdef SWAP_HANDS_ENABLE
    746 #    define SH_T(kc) (QK_SWAP_HANDS | (kc))
    747 #    define SH_TG (QK_SWAP_HANDS | OP_SH_TOGGLE)
    748 #    define SH_TT (QK_SWAP_HANDS | OP_SH_TAP_TOGGLE)
    749 #    define SH_MON (QK_SWAP_HANDS | OP_SH_ON_OFF)
    750 #    define SH_MOFF (QK_SWAP_HANDS | OP_SH_OFF_ON)
    751 #    define SH_ON (QK_SWAP_HANDS | OP_SH_ON)
    752 #    define SH_OFF (QK_SWAP_HANDS | OP_SH_OFF)
    753 #endif
    754 
    755 #endif  // QUANTUM_KEYCODES_H