aboutsummaryrefslogtreecommitdiff
path: root/users/replicaJunction/features/super_alt_tab.c
diff options
context:
space:
mode:
authorJoshua T <replicaJunction@users.noreply.github.com>2021-08-13 20:14:21 -0500
committerGitHub <noreply@github.com>2021-08-13 18:14:21 -0700
commitade989962af613b24687f20f54e2dd0e37240216 (patch)
tree7e6e53b4c4151270f465ca16fc4eeb5270a7870d /users/replicaJunction/features/super_alt_tab.c
parent424b9ff7090d8407bd6bc56ff42afff05acecb12 (diff)
downloadqmk_firmware-ade989962af613b24687f20f54e2dd0e37240216.tar.gz
qmk_firmware-ade989962af613b24687f20f54e2dd0e37240216.zip
[Keymap] clean up userspace, add XD75 / Keyboardio Atreus (#13121)
Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users/replicaJunction/features/super_alt_tab.c')
-rw-r--r--users/replicaJunction/features/super_alt_tab.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/users/replicaJunction/features/super_alt_tab.c b/users/replicaJunction/features/super_alt_tab.c
new file mode 100644
index 000000000..9759898c8
--- /dev/null
+++ b/users/replicaJunction/features/super_alt_tab.c
@@ -0,0 +1,52 @@
1/* Copyright 2021 Joshua T.
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "super_alt_tab.h"
18
19// https://docs.qmk.fm/#/feature_macros?id=super-alt%E2%86%AFtab
20
21bool is_alt_tab_active = false;
22uint16_t alt_tab_timer = 0;
23
24void matrix_scan_super_alt_tab(void) {
25 if (is_alt_tab_active) {
26 if (timer_elapsed(alt_tab_timer) > USER_SUPER_ALT_TAB_TIMEOUT) {
27 unregister_code(KC_LALT);
28 is_alt_tab_active = false;
29 }
30 }
31}
32
33
34bool process_record_super_alt_tab(uint16_t keycode, const keyrecord_t *record) {
35 if (keycode != SALTTAB) {
36 return true;
37 }
38
39 if (record->event.pressed) {
40 if (!is_alt_tab_active) {
41 is_alt_tab_active = true;
42 register_code(KC_LALT);
43 }
44 alt_tab_timer = timer_read();
45 register_code(KC_TAB);
46 }
47 else {
48 unregister_code(KC_TAB);
49 }
50
51 return false;
52}