toggle and hold-tap action shortcuts
This commit is contained in:
parent
909d30553f
commit
d9f08e6177
2 changed files with 22 additions and 2 deletions
|
@ -101,15 +101,25 @@ action_t action_for_key(uint8_t layer, keypos_t key)
|
||||||
action_t action;
|
action_t action;
|
||||||
action.code = ACTION_DEFAULT_LAYER_SET(layer);
|
action.code = ACTION_DEFAULT_LAYER_SET(layer);
|
||||||
return action;
|
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
|
#ifdef MIDI_ENABLE
|
||||||
} else if (keycode >= 0x6000 && keycode < 0x7000) {
|
} else if (keycode >= 0x6000 && keycode < 0x7000) {
|
||||||
action_t action;
|
action_t action;
|
||||||
action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
|
action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
|
||||||
return action;
|
return action;
|
||||||
#endif
|
#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
|
#ifdef UNICODE_ENABLE
|
||||||
} else if (keycode >= 0x8000) {
|
} else if (keycode >= 0x8000000) {
|
||||||
action_t action;
|
action_t action;
|
||||||
uint16_t unicode = keycode & ~(0x8000);
|
uint16_t unicode = keycode & ~(0x8000);
|
||||||
action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);
|
action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);
|
||||||
|
|
|
@ -172,8 +172,18 @@ extern const uint16_t fn_actions[];
|
||||||
// Set default layer - 256 layer max
|
// Set default layer - 256 layer max
|
||||||
#define DF(layer) (layer | 0x5300)
|
#define DF(layer) (layer | 0x5300)
|
||||||
|
|
||||||
|
// Toggle to layer - 256 layer max
|
||||||
|
#define TG(layer) (layer | 0x5400)
|
||||||
|
|
||||||
#define MIDI(n) (n | 0x6000)
|
#define MIDI(n) (n | 0x6000)
|
||||||
|
|
||||||
|
// H-old, T-ap - 256 keycode max
|
||||||
|
#define HT(mod, kc) (kc | 0x7000 | ((mod & 0xF) << 8))
|
||||||
|
#define CTL_T(kc) HT(0x1, kc)
|
||||||
|
#define SFT_T(kc) HT(0x2, kc)
|
||||||
|
#define ALT_T(kc) HT(0x4, kc)
|
||||||
|
#define GUI_T(kc) HT(0x8, kc)
|
||||||
|
|
||||||
// For sending unicode codes.
|
// For sending unicode codes.
|
||||||
// You may not send codes over 1FFF -- this supports most of UTF8.
|
// You may not send codes over 1FFF -- this supports most of UTF8.
|
||||||
// To have a key that sends out Œ, go UC(0x0152)
|
// To have a key that sends out Œ, go UC(0x0152)
|
||||||
|
|
Loading…
Reference in a new issue