diff options
Diffstat (limited to 'users/replicaJunction/features/mouse_jiggle.c')
-rw-r--r-- | users/replicaJunction/features/mouse_jiggle.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/users/replicaJunction/features/mouse_jiggle.c b/users/replicaJunction/features/mouse_jiggle.c new file mode 100644 index 000000000..b2c451d33 --- /dev/null +++ b/users/replicaJunction/features/mouse_jiggle.c | |||
@@ -0,0 +1,46 @@ | |||
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 "mouse_jiggle.h" | ||
18 | |||
19 | bool is_mouse_jiggle_active = false; | ||
20 | |||
21 | void matrix_scan_mouse_jiggle(void) { | ||
22 | if (is_mouse_jiggle_active) { | ||
23 | tap_code(KC_MS_UP); | ||
24 | tap_code(KC_MS_DOWN); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | bool process_record_mouse_jiggle(uint16_t keycode, const keyrecord_t *record) { | ||
29 | if (!record->event.pressed) { | ||
30 | return true; | ||
31 | } | ||
32 | |||
33 | if (is_mouse_jiggle_active) { | ||
34 | // If active, quit whenever another key is pressed | ||
35 | is_mouse_jiggle_active = false; | ||
36 | return true; | ||
37 | } | ||
38 | |||
39 | if (keycode != MS_JIGL) { | ||
40 | return true; | ||
41 | } | ||
42 | |||
43 | is_mouse_jiggle_active = true; | ||
44 | SEND_STRING("Mouse jiggler enabled"); | ||
45 | return false; | ||
46 | } | ||