summaryrefslogtreecommitdiff
path: root/quantum/keymap_common.c
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2015-10-27 22:00:52 -0400
committerJack Humbert <jack.humb@gmail.com>2015-10-27 22:00:52 -0400
commitd9f08e6177271594fa573993d9f4dbc2d98c7416 (patch)
tree98096a91e8625cef8578bd21fed471bef23e955a /quantum/keymap_common.c
parent909d30553fb0324cd021ebfb523e750b0009c636 (diff)
downloadqmk_firmware-d9f08e6177271594fa573993d9f4dbc2d98c7416.tar.gz
qmk_firmware-d9f08e6177271594fa573993d9f4dbc2d98c7416.zip
toggle and hold-tap action shortcuts
Diffstat (limited to 'quantum/keymap_common.c')
-rw-r--r--quantum/keymap_common.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 5c00c0afa2..da75271727 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -101,15 +101,25 @@ action_t action_for_key(uint8_t layer, keypos_t key)
action_t action;
action.code = ACTION_DEFAULT_LAYER_SET(layer);
return action;
- }
+ } else if (type == 0x4) {
+ // Set default layer
+ int layer = keycode & 0xFF;
+ action_t action;
+ action.code = ACTION_LAYER_TOGGLE(layer);
+ return action;
+ }
#ifdef MIDI_ENABLE
} else if (keycode >= 0x6000 && keycode < 0x7000) {
action_t action;
action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
return action;
#endif
+ } else if (keycode >= 0x7000 && keycode < 0x8000) {
+ action_t action;
+ action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
+ return action;
#ifdef UNICODE_ENABLE
- } else if (keycode >= 0x8000) {
+ } else if (keycode >= 0x8000000) {
action_t action;
uint16_t unicode = keycode & ~(0x8000);
action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);