aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Macros.cpp22
-rw-r--r--src/Macros.h2
-rw-r--r--src/MagicCombo.cpp25
-rw-r--r--src/MagicCombo.h27
-rw-r--r--src/TapDance.cpp2
-rw-r--r--src/TapDance.h2
-rw-r--r--src/colormap.map4
-rw-r--r--src/keymap.h22
-rw-r--r--src/model01.ino4
9 files changed, 89 insertions, 21 deletions
diff --git a/src/Macros.cpp b/src/Macros.cpp
index 2fd4229..529bfca 100644
--- a/src/Macros.cpp
+++ b/src/Macros.cpp
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
+#include <Kaleidoscope.h>
#include <Kaleidoscope-OneShot.h>
#include "Macros.h"
@@ -24,18 +25,21 @@
* like i3: without this macro it doesn't see the difference between
* $mod+R0C2 (switch to workspace #2) and $mod+shift+R0C2 (move focused
* container to workspace #2), as R0C2 triggers LSHIFT(Key_2).
+ *
+ * XXX doesn't work with repeats...
+ * https://github.com/keyboardio/Kaleidoscope/issues/647
*/
#define TopRow(k1, k2) \
- if (kaleidoscope::hid::isModifierKeyActive(Key_LeftControl) || \
- ::OneShot.isModifierActive(Key_LeftControl) || \
- kaleidoscope::hid::isModifierKeyActive(Key_RightAlt) || \
- ::OneShot.isModifierActive(Key_RightAlt)) \
- return MACRODOWN(Tr(k2)); \
- else \
- return MACRODOWN(Tr(k1)); \
+ if (keyToggledOn(event.state)) { \
+ if (Kaleidoscope.hid().keyboard().wasModifierKeyActive(Key_LeftControl) || \
+ Kaleidoscope.hid().keyboard().wasModifierKeyActive(Key_RightAlt)) \
+ return MACRO(Dr(k2)); \
+ else \
+ return MACRO(Dr(k1)); \
+ };
-const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
- switch (macroIndex) {
+const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
+ switch (macro_id) {
case AT: TopRow(LSHIFT(Key_2), Key_2);
case STAR: TopRow(LSHIFT(Key_8), Key_3);
case DOLLAR: TopRow(LSHIFT(Key_4), Key_4);
diff --git a/src/Macros.h b/src/Macros.h
index 829308c..5e4395c 100644
--- a/src/Macros.h
+++ b/src/Macros.h
@@ -34,4 +34,4 @@ enum {
, RIGHT_BRACKET
};
-extern const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState);
+extern const macro_t *macroAction(uint8_t macro_id, KeyEvent &event);
diff --git a/src/MagicCombo.cpp b/src/MagicCombo.cpp
new file mode 100644
index 0000000..f24e221
--- /dev/null
+++ b/src/MagicCombo.cpp
@@ -0,0 +1,25 @@
+/***********************************************************************
+ * A firmware Sketch for the Keyboardio Model 01
+ * Copyright © 2019 Guilhem Moulin <guilhem@fripost.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **********************************************************************/
+
+#include <Kaleidoscope-Macros.h>
+#include <Kaleidoscope-MouseKeys.h>
+#include "MagicCombo.h"
+
+void comboMiddleClick(uint8_t combo_index) {
+ Macros.play(MACRO(T(mouseBtnM)));
+}
diff --git a/src/MagicCombo.h b/src/MagicCombo.h
new file mode 100644
index 0000000..1546790
--- /dev/null
+++ b/src/MagicCombo.h
@@ -0,0 +1,27 @@
+/***********************************************************************
+ * A firmware Sketch for the Keyboardio Model 01
+ * Copyright © 2019 Guilhem Moulin <guilhem@fripost.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **********************************************************************/
+
+#pragma once
+
+#include <Kaleidoscope-MagicCombo.h>
+
+enum {
+ MIDDLE_CLICK
+};
+
+extern void comboMiddleClick(uint8_t combo_index);
diff --git a/src/TapDance.cpp b/src/TapDance.cpp
index e5f870d..7af5393 100644
--- a/src/TapDance.cpp
+++ b/src/TapDance.cpp
@@ -20,7 +20,7 @@
#include "TapDance.h"
bool cancelOneShot = false;
-void tapDanceAction(uint8_t tapDanceIndex, byte row, byte col, uint8_t tapCount,
+void tapDanceAction(uint8_t tapDanceIndex, KeyAddr keyAddr, uint8_t tapCount,
kaleidoscope::plugin::TapDance::ActionType tapDanceAction) {
/* Cancel any pending on-shot effects when a tap-dance key is released */
if (tapDanceAction == kaleidoscope::plugin::TapDance::Release)
diff --git a/src/TapDance.h b/src/TapDance.h
index ff90f5e..7129259 100644
--- a/src/TapDance.h
+++ b/src/TapDance.h
@@ -27,5 +27,5 @@ enum {
};
extern bool cancelOneShot;
-extern void tapDanceAction(uint8_t tapDanceIndex, byte row, byte col, uint8_t tapCount,
+extern void tapDanceAction(uint8_t tapDanceIndex, KeyAddr keyAddr, uint8_t tapCount,
kaleidoscope::plugin::TapDance::ActionType tapDanceAction);
diff --git a/src/colormap.map b/src/colormap.map
index 2ba99d4..7387a80 100644
--- a/src/colormap.map
+++ b/src/colormap.map
@@ -7,12 +7,12 @@
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 5
-8 0 0 0 0 0 3 0
+0 0 0 0 0 0 3 0
2 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
-0 6 0 0 0 0 0 0
+8 6 0 0 0 0 0 0
# Nav
diff --git a/src/keymap.h b/src/keymap.h
index a15f725..41f3a20 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -29,6 +29,7 @@ enum {
, LAYER_MAX = NUM
};
+#define Key_LockScreen Consumer_AL_TerminalLockSlashScreensaver
#define Key_PlayPause Consumer_PlaySlashPause
#define Key_Plus LSHIFT(Key_Equals)
#define Key_Underscore LSHIFT(Key_Minus)
@@ -40,7 +41,7 @@ KEYMAPS(
___, M(LEFT_BRACKET), M(AT), M(STAR), M(DOLLAR), M(CARET), ___
, Key_Backtick, Key_Quote, Key_Comma, Key_Period, Key_P, Key_Y, TD(LPB)
, Key_Tab, Key_A, Key_O, Key_E, Key_U, Key_I
- , Key_LeftGui, Key_Slash, Key_Q, Key_J, Key_K, Key_X, TD(COLON)
+ , ___, Key_Slash, Key_Q, Key_J, Key_K, Key_X, TD(COLON)
, OSM(LeftControl), Key_Backspace, OSM(LeftShift), Key_Escape
, OSL(NAV)
@@ -50,16 +51,16 @@ KEYMAPS(
, Key_D, Key_H, Key_T, Key_N, Key_S, Key_Minus
, Key_Equals, Key_B, Key_M, Key_W, Key_V, Key_Z, ___
- , ___, Key_Enter, Key_Spacebar, OSM(RightAlt)
+ , Key_LeftGui, Key_Enter, Key_Spacebar, OSM(RightAlt)
, OSL(NUM)
)
, [NAV] = KEYMAP_STACKED(
- ___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_PrintScreen
- , XXX, Key_mouseScrollR, Key_mouseWarpNW, Key_mouseUp, Key_mouseWarpNE, Key_mouseScrollDn, Key_mouseWarpEnd
- , XXX, Key_mouseScrollL, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseScrollUp
- , ___, XXX, Key_mouseWarpSW, XXX, Key_mouseWarpSE, XXX, Key_mouseBtnL
+ Key_LockScreen, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_PrintScreen
+ , XXX, Key_mouseScrollR, Key_mouseWarpNW, Key_mouseUp, Key_mouseWarpNE, Key_mouseScrollDn, Key_mouseWarpEnd
+ , XXX, Key_mouseScrollL, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseScrollUp
+ , ___, XXX, Key_mouseWarpSW, XXX, Key_mouseWarpSE, XXX, Key_mouseBtnL
, ___, Key_Delete, ___, ___
, ___
@@ -92,3 +93,12 @@ KEYMAPS(
, ___
)
)
+
+/* Magic Combos */
+USE_MAGIC_COMBOS(
+ [MIDDLE_CLICK] = {
+ .action = comboMiddleClick
+ /* Nav + LeftClick + RightClick */
+ , .keys = {R3C6, R2C6, R2C9}
+ }
+)
diff --git a/src/model01.ino b/src/model01.ino
index 61f0871..ba6f088 100644
--- a/src/model01.ino
+++ b/src/model01.ino
@@ -31,6 +31,7 @@
#include <Kaleidoscope-OneShot.h>
#include "Macros.h"
+#include "MagicCombo.h"
#include "TapDance.h"
#include "keymap.h"
@@ -46,6 +47,7 @@ KALEIDOSCOPE_INIT_PLUGINS(
, EscapeOneShot
, ActiveModColorEffect
, Macros
+ , MagicCombo
#ifdef ENABLE_SERIAL
, Focus
#endif
@@ -61,7 +63,7 @@ void setup() {
MouseKeys.speed = 15;
MouseKeys.accelDelay = 35;
- IdleLEDs.idle_time_limit = 60;
+ IdleLEDs.setIdleTimeoutSeconds(60);
}
void loop() {