summaryrefslogtreecommitdiff
path: root/keyboards/dz60/keymaps/_bonfire/not-in-use
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/dz60/keymaps/_bonfire/not-in-use')
-rw-r--r--keyboards/dz60/keymaps/_bonfire/not-in-use/super-alt-tab.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/keyboards/dz60/keymaps/_bonfire/not-in-use/super-alt-tab.c b/keyboards/dz60/keymaps/_bonfire/not-in-use/super-alt-tab.c
new file mode 100644
index 0000000000..1d951b1bcf
--- /dev/null
+++ b/keyboards/dz60/keymaps/_bonfire/not-in-use/super-alt-tab.c
@@ -0,0 +1,37 @@
+/**
+ * Cool Function where a single key does ALT+TAB
+ * From: https://beta.docs.qmk.fm/features/feature_macros#super-alt-tab
+ */
+bool is_alt_tab_active = false; // ADD this near the begining of keymap.c
+uint16_t alt_tab_timer = 0; // we will be using them soon.
+
+enum custom_keycodes { // Make sure have the awesome keycode ready
+ ALT_TAB = SAFE_RANGE,
+};
+
+// key processing
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) { // This will do most of the grunt work with the keycodes.
+ case ALT_TAB:
+ if (record->event.pressed) {
+ if (!is_alt_tab_active) {
+ is_alt_tab_active = true;
+ register_code(KC_LALT);
+ }
+ alt_tab_timer = timer_read();
+ register_code(KC_TAB);
+ } else {
+ unregister_code(KC_TAB);
+ }
+ break;
+ }
+ return true;
+}
+
+// The very important timer.
+void matrix_scan_user(void) {
+ if (is_alt_tab_active && timer_elapsed(alt_tab_timer) > 1000) {
+ unregister_code(KC_LALT);
+ is_alt_tab_active = false;
+ }
+} \ No newline at end of file