summaryrefslogtreecommitdiff
path: root/users/ericgebhart/extensions/oneshot.h
diff options
context:
space:
mode:
authorEric Gebhart <e.a.gebhart@gmail.com>2022-11-12 00:09:41 +0100
committerGitHub <noreply@github.com>2022-11-11 23:09:41 +0000
commit050472a4d07d07c1d9ae17d2fd26d44e9d95d950 (patch)
tree8c326011ec8cac395a92839ec4b420bf12652fa1 /users/ericgebhart/extensions/oneshot.h
parent49a78b81145213e2883e6c3beab6d9c136c10085 (diff)
Eric Gebhart user space and keymaps (#17487)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users/ericgebhart/extensions/oneshot.h')
-rw-r--r--users/ericgebhart/extensions/oneshot.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/users/ericgebhart/extensions/oneshot.h b/users/ericgebhart/extensions/oneshot.h
new file mode 100644
index 0000000000..774dc4ab39
--- /dev/null
+++ b/users/ericgebhart/extensions/oneshot.h
@@ -0,0 +1,37 @@
+#define ENABLE_ONESHOT
+#ifdef ENABLE_ONESHOT
+#pragma once
+
+typedef enum {
+ ONESHOT_LCTL = 0,
+ ONESHOT_LSFT = 1,
+ ONESHOT_LALT = 2,
+ ONESHOT_LGUI = 3,
+ ONESHOT_RCTL = 4,
+ ONESHOT_RSFT = 5,
+ ONESHOT_RALT = 6,
+ ONESHOT_RGUI = 7,
+ ONESHOT_NONE = 8,
+ ONESHOT_MOD_COUNT = 8,
+} oneshot_mod;
+
+
+// This function should be called inside proces_record_user and does everything needed to get one shot modifiers working.
+// Returns true if the keycode needs further handling, false otherwise.
+int8_t update_oneshot_modifiers(uint16_t keycode, keyrecord_t *record, int8_t keycode_consumed);
+int8_t turnoff_oneshot_modifiers(void);
+
+// TO BE IMPLEMENTED BY THE USER
+// This function should return one of the oneshot_mod enumerations (see keymap.c implementation)
+oneshot_mod get_modifier_for_trigger_key(uint16_t keycode);
+
+// TO BE IMPLEMENTED BY THE USER
+// This function should return true for keycodes that must be ignored in the oneshot modifier behaviour.
+// You probably want to ignore layer keys. Trigger keys don't need to be specified here.
+bool is_oneshot_modifier_ignored_key(uint16_t keycode);
+
+// TO BE IMPLEMENTED BY THE USER
+// This function should return true for keycodes that should reset all oneshot modifiers.
+bool is_oneshot_modifier_cancel_key(uint16_t keycode);
+
+#endif