aboutsummaryrefslogtreecommitdiffstats
path: root/src/Macros.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Macros.cpp')
-rw-r--r--src/Macros.cpp22
1 files changed, 13 insertions, 9 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);