summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/action_code.h24
-rw-r--r--quantum/action_util.h1
-rw-r--r--quantum/bootmagic/magic.c2
-rw-r--r--quantum/command.c1
-rw-r--r--quantum/dynamic_keymap.c2
-rw-r--r--quantum/keycode.h20
-rw-r--r--quantum/keymap.h3
-rw-r--r--quantum/keymap_common.h9
-rw-r--r--quantum/keymap_extras/keymap_belgian.h2
-rw-r--r--quantum/keymap_extras/keymap_bepo.h2
-rw-r--r--quantum/keymap_extras/keymap_brazilian_abnt2.h2
-rw-r--r--quantum/keymap_extras/keymap_canadian_multilingual.h2
-rw-r--r--quantum/keymap_extras/keymap_colemak.h2
-rw-r--r--quantum/keymap_extras/keymap_croatian.h2
-rw-r--r--quantum/keymap_extras/keymap_czech.h2
-rw-r--r--quantum/keymap_extras/keymap_danish.h2
-rw-r--r--quantum/keymap_extras/keymap_dvorak.h2
-rw-r--r--quantum/keymap_extras/keymap_dvorak_fr.h2
-rw-r--r--quantum/keymap_extras/keymap_dvorak_programmer.h2
-rw-r--r--quantum/keymap_extras/keymap_estonian.h2
-rw-r--r--quantum/keymap_extras/keymap_finnish.h2
-rw-r--r--quantum/keymap_extras/keymap_french.h2
-rw-r--r--quantum/keymap_extras/keymap_french_afnor.h2
-rw-r--r--quantum/keymap_extras/keymap_french_mac_iso.h2
-rw-r--r--quantum/keymap_extras/keymap_german.h2
-rw-r--r--quantum/keymap_extras/keymap_german_mac_iso.h2
-rw-r--r--quantum/keymap_extras/keymap_greek.h2
-rw-r--r--quantum/keymap_extras/keymap_hebrew.h2
-rw-r--r--quantum/keymap_extras/keymap_hungarian.h2
-rw-r--r--quantum/keymap_extras/keymap_icelandic.h2
-rw-r--r--quantum/keymap_extras/keymap_irish.h2
-rw-r--r--quantum/keymap_extras/keymap_italian.h2
-rw-r--r--quantum/keymap_extras/keymap_italian_mac_ansi.h2
-rw-r--r--quantum/keymap_extras/keymap_italian_mac_iso.h2
-rw-r--r--quantum/keymap_extras/keymap_japanese.h2
-rw-r--r--quantum/keymap_extras/keymap_korean.h2
-rw-r--r--quantum/keymap_extras/keymap_latvian.h2
-rw-r--r--quantum/keymap_extras/keymap_lithuanian_azerty.h2
-rw-r--r--quantum/keymap_extras/keymap_lithuanian_qwerty.h2
-rw-r--r--quantum/keymap_extras/keymap_neo2.h2
-rw-r--r--quantum/keymap_extras/keymap_nordic.h2
-rw-r--r--quantum/keymap_extras/keymap_norman.h2
-rw-r--r--quantum/keymap_extras/keymap_norwegian.h2
-rw-r--r--quantum/keymap_extras/keymap_plover.h2
-rw-r--r--quantum/keymap_extras/keymap_plover_dvorak.h2
-rw-r--r--quantum/keymap_extras/keymap_polish.h2
-rw-r--r--quantum/keymap_extras/keymap_portuguese.h2
-rw-r--r--quantum/keymap_extras/keymap_portuguese_mac_iso.h2
-rw-r--r--quantum/keymap_extras/keymap_romanian.h2
-rw-r--r--quantum/keymap_extras/keymap_russian.h2
-rw-r--r--quantum/keymap_extras/keymap_serbian.h2
-rw-r--r--quantum/keymap_extras/keymap_serbian_latin.h2
-rw-r--r--quantum/keymap_extras/keymap_slovak.h2
-rw-r--r--quantum/keymap_extras/keymap_slovenian.h2
-rw-r--r--quantum/keymap_extras/keymap_spanish.h2
-rw-r--r--quantum/keymap_extras/keymap_spanish_dvorak.h2
-rw-r--r--quantum/keymap_extras/keymap_steno.h2
-rw-r--r--quantum/keymap_extras/keymap_swedish.h2
-rw-r--r--quantum/keymap_extras/keymap_swedish_mac_ansi.h2
-rw-r--r--quantum/keymap_extras/keymap_swedish_mac_iso.h2
-rw-r--r--quantum/keymap_extras/keymap_swedish_pro_mac_ansi.h2
-rw-r--r--quantum/keymap_extras/keymap_swedish_pro_mac_iso.h2
-rw-r--r--quantum/keymap_extras/keymap_swiss_de.h2
-rw-r--r--quantum/keymap_extras/keymap_swiss_fr.h2
-rw-r--r--quantum/keymap_extras/keymap_turkish_f.h2
-rw-r--r--quantum/keymap_extras/keymap_turkish_q.h2
-rw-r--r--quantum/keymap_extras/keymap_uk.h2
-rw-r--r--quantum/keymap_extras/keymap_ukrainian.h2
-rw-r--r--quantum/keymap_extras/keymap_us.h2
-rw-r--r--quantum/keymap_extras/keymap_us_extended.h2
-rw-r--r--quantum/keymap_extras/keymap_us_international.h2
-rw-r--r--quantum/keymap_extras/keymap_us_international_linux.h2
-rw-r--r--quantum/keymap_extras/keymap_workman.h2
-rw-r--r--quantum/keymap_extras/keymap_workman_zxcvm.h2
-rw-r--r--quantum/keymap_introspection.h1
-rw-r--r--quantum/modifiers.h54
76 files changed, 138 insertions, 111 deletions
diff --git a/quantum/action_code.h b/quantum/action_code.h
index 58d929016d..d9a575b518 100644
--- a/quantum/action_code.h
+++ b/quantum/action_code.h
@@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
+#include "modifiers.h"
+
/** \brief Action codes
*
* 16bit code: action_kind(4bit) + action_parameter(12bit)
@@ -160,28 +162,6 @@ typedef union {
#define ACTION_TRANSPARENT 1
#define ACTION(kind, param) ((kind) << 12 | (param))
-/** \brief Key Actions
- *
- * Mod bits: 43210
- * bit 0 ||||+- Control
- * bit 1 |||+-- Shift
- * bit 2 ||+--- Alt
- * bit 3 |+---- Gui
- * bit 4 +----- LR flag(Left:0, Right:1)
- */
-enum mods_bit {
- MOD_LCTL = 0x01,
- MOD_LSFT = 0x02,
- MOD_LALT = 0x04,
- MOD_LGUI = 0x08,
- MOD_RCTL = 0x11,
- MOD_RSFT = 0x12,
- MOD_RALT = 0x14,
- MOD_RGUI = 0x18,
-};
-#define MOD_HYPR (MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI)
-#define MOD_MEH (MOD_LCTL | MOD_LSFT | MOD_LALT)
-
enum mods_codes {
MODS_ONESHOT = 0x00,
MODS_TAP_TOGGLE = 0x01,
diff --git a/quantum/action_util.h b/quantum/action_util.h
index 6f1f09c4bd..0ecf15ae4b 100644
--- a/quantum/action_util.h
+++ b/quantum/action_util.h
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdint.h>
#include "report.h"
+#include "modifiers.h"
#ifdef __cplusplus
extern "C" {
diff --git a/quantum/bootmagic/magic.c b/quantum/bootmagic/magic.c
index f1cb11c395..d68df3fa58 100644
--- a/quantum/bootmagic/magic.c
+++ b/quantum/bootmagic/magic.c
@@ -19,7 +19,7 @@
#include "matrix.h"
#include "bootloader.h"
#include "debug.h"
-#include "keymap.h"
+#include "keycode_config.h"
#include "host.h"
#include "action_layer.h"
#include "eeconfig.h"
diff --git a/quantum/command.c b/quantum/command.c
index 84757b9b01..aa64b75064 100644
--- a/quantum/command.c
+++ b/quantum/command.c
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "wait.h"
#include "keycode.h"
#include "host.h"
-#include "keymap.h"
#include "print.h"
#include "debug.h"
#include "util.h"
diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c
index c406be4585..90a0f20838 100644
--- a/quantum/dynamic_keymap.c
+++ b/quantum/dynamic_keymap.c
@@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "keymap.h" // to get keymaps[][][]
+#include "keymap_introspection.h" // to get keymaps[][][]
#include "eeprom.h"
#include "progmem.h" // to read default from flash
#include "quantum.h" // for send_string()
diff --git a/quantum/keycode.h b/quantum/keycode.h
index 701c078ad0..df1452d296 100644
--- a/quantum/keycode.h
+++ b/quantum/keycode.h
@@ -34,26 +34,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define IS_MOUSEKEY_WHEEL(code) (KC_MS_WH_UP <= (code) && (code) <= KC_MS_WH_RIGHT)
#define IS_MOUSEKEY_ACCEL(code) (KC_MS_ACCEL0 <= (code) && (code) <= KC_MS_ACCEL2)
-#define MOD_BIT(code) (1 << MOD_INDEX(code))
-#define MOD_INDEX(code) ((code)&0x07)
-
-#define MOD_MASK_CTRL (MOD_BIT(KC_LEFT_CTRL) | MOD_BIT(KC_RIGHT_CTRL))
-#define MOD_MASK_SHIFT (MOD_BIT(KC_LEFT_SHIFT) | MOD_BIT(KC_RIGHT_SHIFT))
-#define MOD_MASK_ALT (MOD_BIT(KC_LEFT_ALT) | MOD_BIT(KC_RIGHT_ALT))
-#define MOD_MASK_GUI (MOD_BIT(KC_LEFT_GUI) | MOD_BIT(KC_RIGHT_GUI))
-#define MOD_MASK_CS (MOD_MASK_CTRL | MOD_MASK_SHIFT)
-#define MOD_MASK_CA (MOD_MASK_CTRL | MOD_MASK_ALT)
-#define MOD_MASK_CG (MOD_MASK_CTRL | MOD_MASK_GUI)
-#define MOD_MASK_SA (MOD_MASK_SHIFT | MOD_MASK_ALT)
-#define MOD_MASK_SG (MOD_MASK_SHIFT | MOD_MASK_GUI)
-#define MOD_MASK_AG (MOD_MASK_ALT | MOD_MASK_GUI)
-#define MOD_MASK_CSA (MOD_MASK_CTRL | MOD_MASK_SHIFT | MOD_MASK_ALT)
-#define MOD_MASK_CSG (MOD_MASK_CTRL | MOD_MASK_SHIFT | MOD_MASK_GUI)
-#define MOD_MASK_CAG (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI)
-#define MOD_MASK_SAG (MOD_MASK_SHIFT | MOD_MASK_ALT | MOD_MASK_GUI)
-#define MOD_MASK_CSAG (MOD_MASK_CTRL | MOD_MASK_SHIFT | MOD_MASK_ALT | MOD_MASK_GUI)
+#define MOD_BIT(code) (1 << ((code)&0x07))
// clang-format off
// TODO: dd keycodes
#include "keycodes.h"
+#include "modifiers.h"
diff --git a/quantum/keymap.h b/quantum/keymap.h
index 0225f53362..1263ef188b 100644
--- a/quantum/keymap.h
+++ b/quantum/keymap.h
@@ -30,8 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "quantum_keycodes.h"
-// translates key to keycode
-uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
+#include "keymap_common.h"
#ifdef ENCODER_MAP_ENABLE
// Ensure we have a forward declaration for the encoder map
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h
new file mode 100644
index 0000000000..20e70263f3
--- /dev/null
+++ b/quantum/keymap_common.h
@@ -0,0 +1,9 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <stdint.h>
+
+// translates key to keycode
+uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
diff --git a/quantum/keymap_extras/keymap_belgian.h b/quantum/keymap_extras/keymap_belgian.h
index 1bf9549c5a..6851c6b4e8 100644
--- a/quantum/keymap_extras/keymap_belgian.h
+++ b/quantum/keymap_extras/keymap_belgian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_bepo.h b/quantum/keymap_extras/keymap_bepo.h
index 12026ce649..448727dece 100644
--- a/quantum/keymap_extras/keymap_bepo.h
+++ b/quantum/keymap_extras/keymap_bepo.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_brazilian_abnt2.h b/quantum/keymap_extras/keymap_brazilian_abnt2.h
index 70a09a52be..8fac7666c2 100644
--- a/quantum/keymap_extras/keymap_brazilian_abnt2.h
+++ b/quantum/keymap_extras/keymap_brazilian_abnt2.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_canadian_multilingual.h b/quantum/keymap_extras/keymap_canadian_multilingual.h
index 44009f3aa2..5b9b03babb 100644
--- a/quantum/keymap_extras/keymap_canadian_multilingual.h
+++ b/quantum/keymap_extras/keymap_canadian_multilingual.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_colemak.h b/quantum/keymap_extras/keymap_colemak.h
index 5cb86bf441..d63309f010 100644
--- a/quantum/keymap_extras/keymap_colemak.h
+++ b/quantum/keymap_extras/keymap_colemak.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_croatian.h b/quantum/keymap_extras/keymap_croatian.h
index 1115592e17..3e7c681ced 100644
--- a/quantum/keymap_extras/keymap_croatian.h
+++ b/quantum/keymap_extras/keymap_croatian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_czech.h b/quantum/keymap_extras/keymap_czech.h
index 02692002e3..351c51ad41 100644
--- a/quantum/keymap_extras/keymap_czech.h
+++ b/quantum/keymap_extras/keymap_czech.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_danish.h b/quantum/keymap_extras/keymap_danish.h
index 18107ccd53..cea9444896 100644
--- a/quantum/keymap_extras/keymap_danish.h
+++ b/quantum/keymap_extras/keymap_danish.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_dvorak.h b/quantum/keymap_extras/keymap_dvorak.h
index 5767530b3b..9205a72057 100644
--- a/quantum/keymap_extras/keymap_dvorak.h
+++ b/quantum/keymap_extras/keymap_dvorak.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_dvorak_fr.h b/quantum/keymap_extras/keymap_dvorak_fr.h
index 60675fbf13..b206767614 100644
--- a/quantum/keymap_extras/keymap_dvorak_fr.h
+++ b/quantum/keymap_extras/keymap_dvorak_fr.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_dvorak_programmer.h b/quantum/keymap_extras/keymap_dvorak_programmer.h
index 6e1ae17807..19187ed13b 100644
--- a/quantum/keymap_extras/keymap_dvorak_programmer.h
+++ b/quantum/keymap_extras/keymap_dvorak_programmer.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_estonian.h b/quantum/keymap_extras/keymap_estonian.h
index 462bcde429..ea9c56c12a 100644
--- a/quantum/keymap_extras/keymap_estonian.h
+++ b/quantum/keymap_extras/keymap_estonian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_finnish.h b/quantum/keymap_extras/keymap_finnish.h
index 7e94896e2e..c0dc1af81e 100644
--- a/quantum/keymap_extras/keymap_finnish.h
+++ b/quantum/keymap_extras/keymap_finnish.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_french.h b/quantum/keymap_extras/keymap_french.h
index da9467a475..03dbb7bc40 100644
--- a/quantum/keymap_extras/keymap_french.h
+++ b/quantum/keymap_extras/keymap_french.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_french_afnor.h b/quantum/keymap_extras/keymap_french_afnor.h
index 259e0a30f4..869984c4d2 100644
--- a/quantum/keymap_extras/keymap_french_afnor.h
+++ b/quantum/keymap_extras/keymap_french_afnor.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_french_mac_iso.h b/quantum/keymap_extras/keymap_french_mac_iso.h
index 9a8ed72604..e5f7514a80 100644
--- a/quantum/keymap_extras/keymap_french_mac_iso.h
+++ b/quantum/keymap_extras/keymap_french_mac_iso.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_german.h b/quantum/keymap_extras/keymap_german.h
index 251491fb81..38b0c685ba 100644
--- a/quantum/keymap_extras/keymap_german.h
+++ b/quantum/keymap_extras/keymap_german.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_german_mac_iso.h b/quantum/keymap_extras/keymap_german_mac_iso.h
index de7b60546b..efa9099f20 100644
--- a/quantum/keymap_extras/keymap_german_mac_iso.h
+++ b/quantum/keymap_extras/keymap_german_mac_iso.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_greek.h b/quantum/keymap_extras/keymap_greek.h
index b4f5b5c5b3..01779cf2e8 100644
--- a/quantum/keymap_extras/keymap_greek.h
+++ b/quantum/keymap_extras/keymap_greek.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_hebrew.h b/quantum/keymap_extras/keymap_hebrew.h
index 372d7f2e93..284562072d 100644
--- a/quantum/keymap_extras/keymap_hebrew.h
+++ b/quantum/keymap_extras/keymap_hebrew.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_hungarian.h b/quantum/keymap_extras/keymap_hungarian.h
index 591d71c09c..fbc31ed155 100644
--- a/quantum/keymap_extras/keymap_hungarian.h
+++ b/quantum/keymap_extras/keymap_hungarian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_icelandic.h b/quantum/keymap_extras/keymap_icelandic.h
index 800899b515..3bd71c19f2 100644
--- a/quantum/keymap_extras/keymap_icelandic.h
+++ b/quantum/keymap_extras/keymap_icelandic.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_irish.h b/quantum/keymap_extras/keymap_irish.h
index 2cd63a48e3..6e161628c8 100644
--- a/quantum/keymap_extras/keymap_irish.h
+++ b/quantum/keymap_extras/keymap_irish.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_italian.h b/quantum/keymap_extras/keymap_italian.h
index 95f3348f63..8092dc1301 100644
--- a/quantum/keymap_extras/keymap_italian.h
+++ b/quantum/keymap_extras/keymap_italian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_italian_mac_ansi.h b/quantum/keymap_extras/keymap_italian_mac_ansi.h
index 5e7e2a37e8..ae1281be26 100644
--- a/quantum/keymap_extras/keymap_italian_mac_ansi.h
+++ b/quantum/keymap_extras/keymap_italian_mac_ansi.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_italian_mac_iso.h b/quantum/keymap_extras/keymap_italian_mac_iso.h
index 1d30451376..f3f01839c3 100644
--- a/quantum/keymap_extras/keymap_italian_mac_iso.h
+++ b/quantum/keymap_extras/keymap_italian_mac_iso.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_japanese.h b/quantum/keymap_extras/keymap_japanese.h
index 286863deea..947317833e 100644
--- a/quantum/keymap_extras/keymap_japanese.h
+++ b/quantum/keymap_extras/keymap_japanese.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_korean.h b/quantum/keymap_extras/keymap_korean.h
index 073647de7f..440a6b3b4d 100644
--- a/quantum/keymap_extras/keymap_korean.h
+++ b/quantum/keymap_extras/keymap_korean.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_latvian.h b/quantum/keymap_extras/keymap_latvian.h
index e3ac1cd433..2f26b1d8af 100644
--- a/quantum/keymap_extras/keymap_latvian.h
+++ b/quantum/keymap_extras/keymap_latvian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_lithuanian_azerty.h b/quantum/keymap_extras/keymap_lithuanian_azerty.h
index 11de3ad030..f6dd94f0ca 100644
--- a/quantum/keymap_extras/keymap_lithuanian_azerty.h
+++ b/quantum/keymap_extras/keymap_lithuanian_azerty.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_lithuanian_qwerty.h b/quantum/keymap_extras/keymap_lithuanian_qwerty.h
index c27389971e..03c6b7a2af 100644
--- a/quantum/keymap_extras/keymap_lithuanian_qwerty.h
+++ b/quantum/keymap_extras/keymap_lithuanian_qwerty.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_neo2.h b/quantum/keymap_extras/keymap_neo2.h
index e8352ffa08..bc9445892f 100644
--- a/quantum/keymap_extras/keymap_neo2.h
+++ b/quantum/keymap_extras/keymap_neo2.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_nordic.h b/quantum/keymap_extras/keymap_nordic.h
index e336916713..6464966c71 100644
--- a/quantum/keymap_extras/keymap_nordic.h
+++ b/quantum/keymap_extras/keymap_nordic.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_norman.h b/quantum/keymap_extras/keymap_norman.h
index 1f773bb410..1a3a0bc53a 100644
--- a/quantum/keymap_extras/keymap_norman.h
+++ b/quantum/keymap_extras/keymap_norman.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_norwegian.h b/quantum/keymap_extras/keymap_norwegian.h
index 33193d6a4d..af16fec8d6 100644
--- a/quantum/keymap_extras/keymap_norwegian.h
+++ b/quantum/keymap_extras/keymap_norwegian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_plover.h b/quantum/keymap_extras/keymap_plover.h
index b51e44b8bb..c0e3311e90 100644
--- a/quantum/keymap_extras/keymap_plover.h
+++ b/quantum/keymap_extras/keymap_plover.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_plover_dvorak.h b/quantum/keymap_extras/keymap_plover_dvorak.h
index f8341f8cbc..7feb52a25c 100644
--- a/quantum/keymap_extras/keymap_plover_dvorak.h
+++ b/quantum/keymap_extras/keymap_plover_dvorak.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_polish.h b/quantum/keymap_extras/keymap_polish.h
index 6b37d77a0a..40870ec237 100644
--- a/quantum/keymap_extras/keymap_polish.h
+++ b/quantum/keymap_extras/keymap_polish.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_portuguese.h b/quantum/keymap_extras/keymap_portuguese.h
index 17da9a6c11..b4570ad922 100644
--- a/quantum/keymap_extras/keymap_portuguese.h
+++ b/quantum/keymap_extras/keymap_portuguese.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_portuguese_mac_iso.h b/quantum/keymap_extras/keymap_portuguese_mac_iso.h
index 3d34a39ae5..57a27d04e9 100644
--- a/quantum/keymap_extras/keymap_portuguese_mac_iso.h
+++ b/quantum/keymap_extras/keymap_portuguese_mac_iso.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_romanian.h b/quantum/keymap_extras/keymap_romanian.h
index fb48a0fda7..cf4c17125f 100644
--- a/quantum/keymap_extras/keymap_romanian.h
+++ b/quantum/keymap_extras/keymap_romanian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_russian.h b/quantum/keymap_extras/keymap_russian.h
index 3643718444..fd3a1604c8 100644
--- a/quantum/keymap_extras/keymap_russian.h
+++ b/quantum/keymap_extras/keymap_russian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_serbian.h b/quantum/keymap_extras/keymap_serbian.h
index dd1bda7533..732e2e939d 100644
--- a/quantum/keymap_extras/keymap_serbian.h
+++ b/quantum/keymap_extras/keymap_serbian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_serbian_latin.h b/quantum/keymap_extras/keymap_serbian_latin.h
index 83495b63be..5151696a10 100644
--- a/quantum/keymap_extras/keymap_serbian_latin.h
+++ b/quantum/keymap_extras/keymap_serbian_latin.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_slovak.h b/quantum/keymap_extras/keymap_slovak.h
index 10714f1be9..81a88fa25c 100644
--- a/quantum/keymap_extras/keymap_slovak.h
+++ b/quantum/keymap_extras/keymap_slovak.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_slovenian.h b/quantum/keymap_extras/keymap_slovenian.h
index 30910530e0..1e17342c27 100644
--- a/quantum/keymap_extras/keymap_slovenian.h
+++ b/quantum/keymap_extras/keymap_slovenian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_spanish.h b/quantum/keymap_extras/keymap_spanish.h
index cac16c08a5..bcdd5af0c2 100644
--- a/quantum/keymap_extras/keymap_spanish.h
+++ b/quantum/keymap_extras/keymap_spanish.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_spanish_dvorak.h b/quantum/keymap_extras/keymap_spanish_dvorak.h
index 1feab96b8c..fb033df770 100644
--- a/quantum/keymap_extras/keymap_spanish_dvorak.h
+++ b/quantum/keymap_extras/keymap_spanish_dvorak.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_steno.h b/quantum/keymap_extras/keymap_steno.h
index 07d96b7465..852b2f7121 100644
--- a/quantum/keymap_extras/keymap_steno.h
+++ b/quantum/keymap_extras/keymap_steno.h
@@ -16,7 +16,7 @@
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// List of keycodes for the steno keyboard. To prevent
// errors, this must be <= 42 total entries in order to
diff --git a/quantum/keymap_extras/keymap_swedish.h b/quantum/keymap_extras/keymap_swedish.h
index 4cdf4879c3..acb49f7773 100644
--- a/quantum/keymap_extras/keymap_swedish.h
+++ b/quantum/keymap_extras/keymap_swedish.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_swedish_mac_ansi.h b/quantum/keymap_extras/keymap_swedish_mac_ansi.h
index 9649f59dd0..ef48a9e493 100644
--- a/quantum/keymap_extras/keymap_swedish_mac_ansi.h
+++ b/quantum/keymap_extras/keymap_swedish_mac_ansi.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_swedish_mac_iso.h b/quantum/keymap_extras/keymap_swedish_mac_iso.h
index 068c81b020..2eaef5e60c 100644
--- a/quantum/keymap_extras/keymap_swedish_mac_iso.h
+++ b/quantum/keymap_extras/keymap_swedish_mac_iso.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_swedish_pro_mac_ansi.h b/quantum/keymap_extras/keymap_swedish_pro_mac_ansi.h
index c0692ababd..d33a259023 100644
--- a/quantum/keymap_extras/keymap_swedish_pro_mac_ansi.h
+++ b/quantum/keymap_extras/keymap_swedish_pro_mac_ansi.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_swedish_pro_mac_iso.h b/quantum/keymap_extras/keymap_swedish_pro_mac_iso.h
index e01f0a7dc3..680bd1db9e 100644
--- a/quantum/keymap_extras/keymap_swedish_pro_mac_iso.h
+++ b/quantum/keymap_extras/keymap_swedish_pro_mac_iso.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_swiss_de.h b/quantum/keymap_extras/keymap_swiss_de.h
index 0a6e6e4918..69bba7293e 100644
--- a/quantum/keymap_extras/keymap_swiss_de.h
+++ b/quantum/keymap_extras/keymap_swiss_de.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_swiss_fr.h b/quantum/keymap_extras/keymap_swiss_fr.h
index 05a4a4c279..1e2f833db1 100644
--- a/quantum/keymap_extras/keymap_swiss_fr.h
+++ b/quantum/keymap_extras/keymap_swiss_fr.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_turkish_f.h b/quantum/keymap_extras/keymap_turkish_f.h
index 0dfc0236e8..4fdcf3f746 100644
--- a/quantum/keymap_extras/keymap_turkish_f.h
+++ b/quantum/keymap_extras/keymap_turkish_f.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_turkish_q.h b/quantum/keymap_extras/keymap_turkish_q.h
index cc64300b18..5a9362acb4 100644
--- a/quantum/keymap_extras/keymap_turkish_q.h
+++ b/quantum/keymap_extras/keymap_turkish_q.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_uk.h b/quantum/keymap_extras/keymap_uk.h
index ff6f8c9c2e..71e5f38f55 100644
--- a/quantum/keymap_extras/keymap_uk.h
+++ b/quantum/keymap_extras/keymap_uk.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_ukrainian.h b/quantum/keymap_extras/keymap_ukrainian.h
index b954bb2398..3f3ec4cec2 100644
--- a/quantum/keymap_extras/keymap_ukrainian.h
+++ b/quantum/keymap_extras/keymap_ukrainian.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_us.h b/quantum/keymap_extras/keymap_us.h
index 38df8c6336..6101c8d8ba 100644
--- a/quantum/keymap_extras/keymap_us.h
+++ b/quantum/keymap_extras/keymap_us.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_us_extended.h b/quantum/keymap_extras/keymap_us_extended.h
index c4f627c30d..90da98c756 100644
--- a/quantum/keymap_extras/keymap_us_extended.h
+++ b/quantum/keymap_extras/keymap_us_extended.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_us_international.h b/quantum/keymap_extras/keymap_us_international.h
index 1f2bc33476..bd5f21ec8c 100644
--- a/quantum/keymap_extras/keymap_us_international.h
+++ b/quantum/keymap_extras/keymap_us_international.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_us_international_linux.h b/quantum/keymap_extras/keymap_us_international_linux.h
index 16d072cc5b..4551cbe29f 100644
--- a/quantum/keymap_extras/keymap_us_international_linux.h
+++ b/quantum/keymap_extras/keymap_us_international_linux.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_workman.h b/quantum/keymap_extras/keymap_workman.h
index 5fe9d36b16..808caec054 100644
--- a/quantum/keymap_extras/keymap_workman.h
+++ b/quantum/keymap_extras/keymap_workman.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_extras/keymap_workman_zxcvm.h b/quantum/keymap_extras/keymap_workman_zxcvm.h
index 757f98e912..f8645ac4cf 100644
--- a/quantum/keymap_extras/keymap_workman_zxcvm.h
+++ b/quantum/keymap_extras/keymap_workman_zxcvm.h
@@ -24,7 +24,7 @@
*******************************************************************************/
#pragma once
-#include "keymap.h"
+#include "keycodes.h"
// clang-format off
// Aliases
diff --git a/quantum/keymap_introspection.h b/quantum/keymap_introspection.h
index a8df3928a6..201de937cb 100644
--- a/quantum/keymap_introspection.h
+++ b/quantum/keymap_introspection.h
@@ -3,6 +3,7 @@
#pragma once
#include <stdint.h>
+#include <stdbool.h>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Key mapping
diff --git a/quantum/modifiers.h b/quantum/modifiers.h
new file mode 100644
index 0000000000..45bcd6508d
--- /dev/null
+++ b/quantum/modifiers.h
@@ -0,0 +1,54 @@
+// Copyright 2023 QMK
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+/** \brief 5-bit packed modifiers
+ *
+ * Mod bits: 43210
+ * bit 0 ||||+- Control
+ * bit 1 |||+-- Shift
+ * bit 2 ||+--- Alt
+ * bit 3 |+---- Gui
+ * bit 4 +----- LR flag(Left:0, Right:1)
+ */
+enum mods_5bit {
+ MOD_LCTL = 0x01,
+ MOD_LSFT = 0x02,
+ MOD_LALT = 0x04,
+ MOD_LGUI = 0x08,
+ MOD_RCTL = 0x11,
+ MOD_RSFT = 0x12,
+ MOD_RALT = 0x14,
+ MOD_RGUI = 0x18,
+};
+#define MOD_HYPR (MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI)
+#define MOD_MEH (MOD_LCTL | MOD_LSFT | MOD_LALT)
+
+/** \brief 8-bit packed modifiers
+ */
+enum mods_8bit {
+ MOD_BIT_LCTRL = 0b00000001,
+ MOD_BIT_LSHIFT = 0b00000010,
+ MOD_BIT_LALT = 0b00000100,
+ MOD_BIT_LGUI = 0b00001000,
+ MOD_BIT_RCTRL = 0b00010000,
+ MOD_BIT_RSHIFT = 0b00100000,
+ MOD_BIT_RALT = 0b01000000,
+ MOD_BIT_RGUI = 0b10000000,
+};
+#define MOD_MASK_CTRL (MOD_BIT_LCTRL | MOD_BIT_RCTRL)
+#define MOD_MASK_SHIFT (MOD_BIT_LSHIFT | MOD_BIT_RSHIFT)
+#define MOD_MASK_ALT (MOD_BIT_LALT | MOD_BIT_RALT)
+#define MOD_MASK_GUI (MOD_BIT_LGUI | MOD_BIT_RGUI)
+#define MOD_MASK_CS (MOD_MASK_CTRL | MOD_MASK_SHIFT)
+#define MOD_MASK_CA (MOD_MASK_CTRL | MOD_MASK_ALT)
+#define MOD_MASK_CG (MOD_MASK_CTRL | MOD_MASK_GUI)
+#define MOD_MASK_SA (MOD_MASK_SHIFT | MOD_MASK_ALT)
+#define MOD_MASK_SG (MOD_MASK_SHIFT | MOD_MASK_GUI)
+#define MOD_MASK_AG (MOD_MASK_ALT | MOD_MASK_GUI)
+#define MOD_MASK_CSA (MOD_MASK_CTRL | MOD_MASK_SHIFT | MOD_MASK_ALT)
+#define MOD_MASK_CSG (MOD_MASK_CTRL | MOD_MASK_SHIFT | MOD_MASK_GUI)
+#define MOD_MASK_CAG (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI)
+#define MOD_MASK_SAG (MOD_MASK_SHIFT | MOD_MASK_ALT | MOD_MASK_GUI)
+#define MOD_MASK_CSAG (MOD_MASK_CTRL | MOD_MASK_SHIFT | MOD_MASK_ALT | MOD_MASK_GUI)