summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keymap-layers.h9
-rw-r--r--keymap-wrapper.h6
-rw-r--r--keymaps.h2
-rw-r--r--macros.h20
4 files changed, 30 insertions, 7 deletions
diff --git a/keymap-layers.h b/keymap-layers.h
new file mode 100644
index 0000000..2fb0e80
--- /dev/null
+++ b/keymap-layers.h
@@ -0,0 +1,9 @@
+// -*- mode: c++ -*-
+#pragma once
+
+#include "keymap-layers.h"
+
+enum { PRIMARY, NUMPAD, FUNCTION, FVWM }; // layers
+
+#define PRIMARY_KEYMAP_QWERTY
+// #define PRIMARY_KEYMAP_DVORAK
diff --git a/keymap-wrapper.h b/keymap-wrapper.h
index 808eb2f..7e6f8b0 100644
--- a/keymap-wrapper.h
+++ b/keymap-wrapper.h
@@ -2,11 +2,7 @@
#pragma once
#include "Kaleidoscope-MouseKeys.h"
-
-enum { PRIMARY, NUMPAD, FUNCTION, FVWM }; // layers
-
-#define PRIMARY_KEYMAP_QWERTY
-// #define PRIMARY_KEYMAP_DVORAK
+#include "keymap-layers.h"
#define CK(k,c) k
diff --git a/keymaps.h b/keymaps.h
index 4932ab1..70b0e8f 100644
--- a/keymaps.h
+++ b/keymaps.h
@@ -12,7 +12,7 @@ ColorKeymaps(
CK(Key_LeftControl,Base), CK(Key_Backspace,Base), CK(Key_LeftGui,Base), CK(Key_LeftShift,Base),
CK(ShiftToLayer(FVWM),Base),
- CK(M(MACRO_ANY),Base), CK(Key_6,Base), CK(Key_7,Base), CK(Key_8,Base), CK(Key_9,Base), CK(Key_0,Base), CK(LockLayer(NUMPAD),Base),
+ CK(M(MACRO_ANY),Base), CK(Key_6,Base), CK(Key_7,Base), CK(Key_8,Base), CK(Key_9,Base), CK(Key_0,Base), CK(M(MACRO_NUMLOCK),Base),
CK(Key_Enter,Base), CK(Key_Y,Base), CK(Key_U,Base), CK(Key_I,Base), CK(Key_O,Base), CK(Key_P,Base), CK(Key_Equals,Base),
CK(Key_H,Base), CK(Key_J,Base), CK(Key_K,Base), CK(Key_L,Base), CK(Key_Semicolon,Base), CK(Key_Quote,Base),
CK(Key_RightAlt,Base), CK(Key_N,Base), CK(Key_M,Base), CK(Key_Comma,Base), CK(Key_Period,Base), CK(Key_Slash,Base), CK(Key_Minus,Base),
diff --git a/macros.h b/macros.h
index 06df775..715d2bc 100644
--- a/macros.h
+++ b/macros.h
@@ -2,9 +2,11 @@
#pragma once
#include "kaleidoscope/plugin/Macros.h"
+#include "keymap-layers.h"
enum { MACRO_VERSION_INFO,
- MACRO_ANY
+ MACRO_ANY,
+ MACRO_NUMLOCK,
};
#ifndef BUILD_INFORMATION
@@ -30,6 +32,18 @@ static void anyKeyMacro(uint8_t keyState) {
kaleidoscope::hid::pressKey(lastKey, toggledOn);
}
+static void numLockMacro(uint8_t keyState) {
+ if (keyToggledOn(keyState)) {
+ kaleidoscope::hid::pressKey(Key_KeypadNumLock);
+ if (Layer.isActive(NUMPAD)) {
+ Layer.deactivate(NUMPAD);
+ }
+ else {
+ Layer.activate(NUMPAD);
+ }
+ }
+}
+
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
switch (macroIndex) {
@@ -40,6 +54,10 @@ const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
case MACRO_ANY:
anyKeyMacro(keyState);
break;
+
+ case MACRO_NUMLOCK:
+ numLockMacro(keyState);
+ break;
}
return MACRO_NONE;
}