aboutsummaryrefslogtreecommitdiff
path: root/users/riblee/riblee.c
diff options
context:
space:
mode:
Diffstat (limited to 'users/riblee/riblee.c')
-rw-r--r--users/riblee/riblee.c166
1 files changed, 166 insertions, 0 deletions
diff --git a/users/riblee/riblee.c b/users/riblee/riblee.c
new file mode 100644
index 000000000..e1fe607ef
--- /dev/null
+++ b/users/riblee/riblee.c
@@ -0,0 +1,166 @@
1/* Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee
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 "riblee.h"
18
19const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
20
21// Tap Dance functions
22void dance_key_a (qk_tap_dance_state_t *state, void *user_data) {
23 if (state->count == 1) {
24 SEND_STRING("a");
25 reset_tap_dance(state);
26 } else if (state->count == 2) {
27 if (!(keyboard_report->mods & shift)) {
28 send_unicode_string("á");
29 } else {
30 send_unicode_string("Á");
31 }
32
33 reset_tap_dance(state);
34 }
35}
36
37void dance_key_e (qk_tap_dance_state_t *state, void *user_data) {
38 if (state->count == 1) {
39 SEND_STRING("e");
40 reset_tap_dance(state);
41 } else if (state->count == 2) {
42 if (!(keyboard_report->mods & shift)) {
43 send_unicode_string("é");
44 } else {
45 send_unicode_string("É");
46 }
47
48 reset_tap_dance(state);
49 }
50}
51
52void dance_key_i (qk_tap_dance_state_t *state, void *user_data) {
53 if (state->count == 1) {
54 SEND_STRING("i");
55 reset_tap_dance(state);
56 } else if (state->count == 2) {
57 if (!(keyboard_report->mods & shift)) {
58 send_unicode_string("í");
59 } else {
60 send_unicode_string("Í");
61 }
62
63 reset_tap_dance(state);
64 }
65}
66
67void dance_key_o (qk_tap_dance_state_t *state, void *user_data) {
68 if (state->count == 1) {
69 SEND_STRING("o");
70 reset_tap_dance(state);
71 } else if (state->count == 2) {
72 if (!(keyboard_report->mods & shift)) {
73 send_unicode_string("ó");
74 } else {
75 send_unicode_string("Ó");
76 }
77
78 reset_tap_dance(state);
79 } else if (state->count == 3) {
80 if (!(keyboard_report->mods & shift)) {
81 send_unicode_string("ö");
82 } else {
83 send_unicode_string("Ö");
84 }
85
86 reset_tap_dance(state);
87 } else if (state->count == 4) {
88 if (!(keyboard_report->mods & shift)) {
89 send_unicode_string("ő");
90 } else {
91 send_unicode_string("Ő");
92 }
93
94 reset_tap_dance(state);
95 }
96}
97
98void dance_key_u (qk_tap_dance_state_t *state, void *user_data) {
99 if (state->count == 1) {
100 SEND_STRING("u");
101 reset_tap_dance(state);
102 } else if (state->count == 2) {
103 if (!(keyboard_report->mods & shift)) {
104 send_unicode_string("ú");
105 } else {
106 send_unicode_string("Ú");
107 }
108
109 reset_tap_dance(state);
110 } else if (state->count == 3) {
111 if (!(keyboard_report->mods & shift)) {
112 send_unicode_string("ü");
113 } else {
114 send_unicode_string("Ü");
115 }
116
117 reset_tap_dance(state);
118 } else if (state->count == 4) {
119 if (!(keyboard_report->mods & shift)) {
120 send_unicode_string("ű");
121 } else {
122 send_unicode_string("Ű");
123 }
124
125 reset_tap_dance(state);
126 }
127}
128
129layer_state_t layer_state_set_user(layer_state_t state) {
130 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
131}
132
133bool process_record_user(uint16_t keycode, keyrecord_t *record) {
134 switch (keycode) {
135 case QWERTY:
136 if (record->event.pressed) {
137 set_single_persistent_default_layer(_QWERTY);
138 }
139 return false;
140 break;
141 case COLEMAK:
142 if (record->event.pressed) {
143 set_single_persistent_default_layer(_COLEMAK);
144 }
145 return false;
146 break;
147 case DVORAK:
148 if (record->event.pressed) {
149 set_single_persistent_default_layer(_DVORAK);
150 }
151 return false;
152 break;
153 case BACKLIT:
154 if (record->event.pressed) {
155 register_code(keycode_config(KC_LGUI));
156#ifdef BACKLIGHT_ENABLE
157 backlight_step();
158#endif
159 } else {
160 unregister_code(keycode_config(KC_LGUI));
161 }
162 return false;
163 break;
164 }
165 return true;
166};