aboutsummaryrefslogtreecommitdiff
path: root/users/moults31/moults31.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/moults31/moults31.c')
-rw-r--r--users/moults31/moults31.c114
1 files changed, 114 insertions, 0 deletions
diff --git a/users/moults31/moults31.c b/users/moults31/moults31.c
new file mode 100644
index 000000000..0dbaed0bb
--- /dev/null
+++ b/users/moults31/moults31.c
@@ -0,0 +1,114 @@
1/* Copyright 2021 moults31
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#include "moults31.h"
17
18bool moults31_tap_custom_code(uint16_t keycode) {
19 keyrecord_t record = {
20 .event = {
21 .pressed = 1,
22 },
23 };
24 return process_record_user(keycode, &record);
25}
26
27bool process_record_user(uint16_t keycode, keyrecord_t *record) {
28 bool rv = true;
29 switch (keycode) {
30 case M_MST_CODEBLOCK:
31 if (record->event.pressed) {
32 SEND_STRING("```");
33 }
34 break;
35
36 case M_VSC_TERMFOCUS:
37 case M_VSC_SIDEBARFOCUS:
38 case M_VSC_SIDEBARCLOSE:
39 case M_VSC_FILECLOSE:
40 case M_VSC_FILENXT:
41 case M_VSC_FILEPRV:
42 case M_VSC_DBGCNSLFOCUS:
43 case M_VSC_MVEDTRNXTGRP:
44 case M_VSC_MVEDTRPRVGRP:
45 case M_VSC_EDGRPNXT:
46 case M_VSC_EDGRPPRV:
47 case M_VSC_VIEWSIZEINC:
48 case M_VSC_VIEWSIZEDEC:
49 rv = process_record_vsc(keycode, record);
50 break;
51
52 case M_GDB_PLAY:
53 case M_GDB_PAUSE:
54 case M_GDB_STEPOVER:
55 case M_GDB_STEPIN:
56 case M_GDB_STEPOUT:
57 case M_GDB_RESTART:
58 case M_GDB_STOP:
59 rv = process_record_gdb(keycode, record);
60 break;
61
62 case M_OBS_BRB:
63 case M_OBS_GAME:
64 case M_OBS_JSTCHT:
65 case M_OBS_DSKT_MUTE:
66 case M_OBS_DSKT_UNMUTE:
67 case M_OBS_VOICE_MUTE:
68 case M_OBS_VOICE_UNMUTE:
69 case M_OBS_MOOSIC_MUTE:
70 case M_OBS_MOOSIC_UNMUTE:
71 rv = process_record_obs(keycode, record);
72 break;
73 }
74 return rv;
75};
76
77#ifdef ENCODER_ENABLE
78__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) {
79 const layer_state_t curr_layer = get_highest_layer(layer_state);
80 if (index == 1) { /* Bottom encoder */
81 if(curr_layer == 2 || curr_layer == 3) {
82 if (clockwise) {
83 moults31_tap_custom_code(M_VSC_FILENXT);
84 } else {
85 moults31_tap_custom_code(M_VSC_FILEPRV);
86 }
87 }
88 else {
89 if (clockwise) {
90 tap_code(KC_VOLU);
91 } else {
92 tap_code(KC_VOLD);
93 }
94 }
95 }
96 if (index == 0) { /* Top encoder */
97 if(curr_layer == 2 || curr_layer == 3) {
98 if (clockwise) {
99 moults31_tap_custom_code(M_VSC_VIEWSIZEINC);
100 } else {
101 moults31_tap_custom_code(M_VSC_VIEWSIZEDEC);
102 }
103 }
104 else {
105 if (clockwise) {
106 tap_code(KC_MNXT);
107 } else {
108 tap_code(KC_MPRV);
109 }
110 }
111 }
112 return false;
113}
114#endif