From 5289373f82e08e2a3a4c19796502eb897bfd749e Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Thu, 1 Dec 2016 10:06:34 +0100 Subject: [PATCH] key_defs: Helpers for holding mods with keys Add a number of helper macros that aid in constructing the Key code for keys with modifiers held. These can, of course, be embedded in each other, so to have a key on the keymap that has all currently supported modifiers pressed, along with `X`, one would write: `LCTRL(LALT(RALT(LSHIFT(LGUI(X)))))` Signed-off-by: Gergely Nagy --- src/key_defs.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/key_defs.h b/src/key_defs.h index fbcb1ccf..66feb201 100644 --- a/src/key_defs.h +++ b/src/key_defs.h @@ -249,4 +249,8 @@ typedef union { #define Key_LEDEffectNext (Key) { KEY_FLAGS | SYNTHETIC | IS_INTERNAL, LED_TOGGLE } - +#define LCTRL(k) (Key) { k.flags | CTRL_HELD, k.rawKey } +#define LALT(k) (Key) { k.flags | LALT_HELD, k.rawKey } +#define RALT(k) (Key) { k.flags | RALT_HELD, k.rawKey } +#define LSHIFT(k) (Key) { k.flags | SHIFT_HELD, k.rawKey } +#define LGUI(k) (Key) { k.flags | GUI_HELD, k.rawKey }