aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Ewers <ewersp@gmail.com>2021-12-27 01:56:56 -0800
committerGitHub <noreply@github.com>2021-12-27 20:56:56 +1100
commit24f33460a22cd09a68e7e1120bb6c5a605bb34c8 (patch)
tree57652cb7ba1c3822b1283220f7ff1b7f2cbddaa9
parent005290c6cf6ad2f960bff8cade10f1ba24596cbb (diff)
downloadqmk_firmware-24f33460a22cd09a68e7e1120bb6c5a605bb34c8.tar.gz
qmk_firmware-24f33460a22cd09a68e7e1120bb6c5a605bb34c8.zip
[Keymap] Adding 'super alt' keymap for Wuque ikki68 Aurora (#14838)
* [Keymap] Adding personal keymap for ikki68 Aurora * Add license headers * Added support to toggle LED modes * Added a toggleable layer for macOS (which swaps the GUI/ALT positions)
-rw-r--r--keyboards/wuque/ikki68_aurora/keymaps/ewersp/README.md40
-rw-r--r--keyboards/wuque/ikki68_aurora/keymaps/ewersp/config.h19
-rw-r--r--keyboards/wuque/ikki68_aurora/keymaps/ewersp/keymap.c215
-rw-r--r--keyboards/wuque/ikki68_aurora/keymaps/ewersp/rules.mk1
4 files changed, 275 insertions, 0 deletions
diff --git a/keyboards/wuque/ikki68_aurora/keymaps/ewersp/README.md b/keyboards/wuque/ikki68_aurora/keymaps/ewersp/README.md
new file mode 100644
index 000000000..3e84b4ee6
--- /dev/null
+++ b/keyboards/wuque/ikki68_aurora/keymaps/ewersp/README.md
@@ -0,0 +1,40 @@
1## Greetings, Traveler!
2
3This layout is for the [Wuque ikki68 Aurora](https://shop.wuquestudio.com/pages/ikki68-aurora) and is primarily meant for Windows.
4
5The keymap is similar to the default keymap for the Aurora, but it overloads the left alt key to behave like an additional 'Fn' key while keeping the standard functionality of the alt key intact.
6
7### For Example
8```
9LeftAlt + 1...N -> F1...FN
10LeftAlt + L/R Arrows -> Home/End
11LeftAlt + Home -> End
12LeftAlt + Backspace -> Delete
13LeftAlt + Esc -> Backtick (`)
14LeftAlt + Shift + Esc -> Tilde (~)
15LeftAlt + LeftShift + 4 -> Alt+F4
16```
17
18The novel part of this keymap is that it **preserves the default functionality** of the left alt key, so ```'alt + tab', 'ctrl + alt + del', 'alt + f4'```, etc. all work as expected without having to use timers.
19
20Everything also works with other modifier keys, so ```'alt + L/R' and 'alt + shift + L/R'``` work great for text manipulation to select lines.
21
22This **super alt** keymap will feel very familiar for anyone **coming from macOS** since the Windows alt key is in the same position as CMD on macOS keyboards.
23
24And finally, the original alt key functionality can be toggled at any time by pressing ```'Fn + period'``` so for example if a game requires use of the left alt, you can easily turn it off.
25
26### Toggle LED Modes
27You can also cycle though multiple LED modes (underglow, logo, all, none) by pressing ```'Fn + x'``` (the default ikki68 Aurora keymap only supports all or none). The last value set is persisted in EEPROM.
28
29### Compiling/Flashing
301) After installing QMK MSYS, open the QMK MSYS terminal
312) Type ```qmk compile -kb wuque/ikki68_aurora -km ewersp``` to test compilation
323) Type ```qmk flash -kb wuque/ikki68_aurora -km ewersp``` to start flashing
334) Press ```Fn+Page Up``` to put your keyboard into bootloader mode
34 - Note: After installing the keymap, to enter bootloader mode again press and hold ```Fn+B``` for half a second
355) Wait for the ```Validating... Success``` message to appear and you're done!
36 - Note: If it gets stuck on ```Bootloader not found. Trying again every 0.5s...``` you may need to run QMK Toolbox to install/update drivers
37
38If you have any questions, feel free to reach out to me at: ewersp [at] gmail [dot] com.
39
40Enjoy! **<3**
diff --git a/keyboards/wuque/ikki68_aurora/keymaps/ewersp/config.h b/keyboards/wuque/ikki68_aurora/keymaps/ewersp/config.h
new file mode 100644
index 000000000..1282334dc
--- /dev/null
+++ b/keyboards/wuque/ikki68_aurora/keymaps/ewersp/config.h
@@ -0,0 +1,19 @@
1/* Copyright 2021 Paul Ewers
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#pragma once
18
19#define FORCE_NKRO
diff --git a/keyboards/wuque/ikki68_aurora/keymaps/ewersp/keymap.c b/keyboards/wuque/ikki68_aurora/keymaps/ewersp/keymap.c
new file mode 100644
index 000000000..5983625ad
--- /dev/null
+++ b/keyboards/wuque/ikki68_aurora/keymaps/ewersp/keymap.c
@@ -0,0 +1,215 @@
1/* Copyright 2021 Paul Ewers
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 QMK_KEYBOARD_H
18
19enum alt_keycodes {
20 ALT_DEL = SAFE_RANGE, // Map left alt + backspace to delete
21 LED_TOG // Toggle LED modes
22};
23
24// Friendly layer names
25enum alt_layers {
26 DEF = 0,
27 ALT,
28 MAC,
29 FUNC,
30 SUPR
31};
32
33// EEPROM storage mode
34enum alt_led_mode {
35 LED_MODE_ALL = 0,
36 LED_MODE_LOGO,
37 LED_MODE_UNDERGLOW,
38 LED_MODE_OFF,
39 LED_MODE_TOTAL
40};
41
42// EEPROM storage type
43typedef union {
44 uint32_t raw;
45 struct {
46 uint8_t led_mode: 8;
47 };
48} user_config_t;
49
50user_config_t user_config;
51
52const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
53 [DEF] = LAYOUT_all(
54 KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC, KC_HOME, KC_PGUP,
55 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_PGDN,
56 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
57 KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP,
58 KC_LCTL, KC_LGUI, MO(SUPR), KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(FUNC),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
59 ),
60 [ALT] = LAYOUT_all(
61 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
62 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
63 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
64 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
65 _______, _______, KC_LALT, _______, _______, _______, _______, _______, _______, _______, _______, _______
66 ),
67 [MAC] = LAYOUT_all(
68 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
70 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
71 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
72 _______, KC_LALT, KC_LGUI, _______, _______, _______, KC_RGUI, _______, KC_RALT, _______, _______, _______
73 ),
74 [FUNC] = LAYOUT_all(
75 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_END, KC_VOLU,
76 _______, RGB_HUD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_M_P, _______, _______, _______, KC_BRIU, KC_PAUS, KC_PSCR, _______, _______, KC_MUTE, KC_VOLD,
77 _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_SAD, RGB_M_B, _______, _______, _______, KC_BRID, _______, _______, _______,
78 _______, _______, RGB_TOG, LED_TOG, _______, EEP_RST, RESET, _______, _______, TG(MAC), TG(ALT), _______, _______, _______, KC_PGUP,
79 _______, _______, KC_LALT, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END
80 ),
81 [SUPR] = LAYOUT_all(
82 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ALT_DEL, ALT_DEL, KC_END, _______,
83 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
84 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
85 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
86 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, _______, KC_END
87 )
88};
89
90// If the super alt layer is the active layer
91bool super_alt_layer_active = false;
92
93// If we need to unregister alt when leaving the super alt layer
94bool need_to_unregister_alt = false;
95
96// This runs code every time that the layers get changed
97layer_state_t layer_state_set_user(layer_state_t state) {
98 switch (get_highest_layer(state)) {
99 case DEF:
100 // When returning to the default layer, check if we need to unregister the left alt key
101 if (super_alt_layer_active && need_to_unregister_alt) {
102 unregister_code(KC_LALT);
103 }
104 super_alt_layer_active = false;
105 need_to_unregister_alt = false;
106 break;
107 case SUPR:
108 super_alt_layer_active = true;
109 break;
110 }
111 return state;
112}
113
114// There is a total of 20 LEDs on the board; the 4 logo LEDs have indices 16, 17, 18, 19
115void update_led_mode(void) {
116 rgblight_setrgb(0, 0, 0);
117 switch (user_config.led_mode) {
118 case LED_MODE_ALL:
119 rgblight_set_effect_range(0, RGBLED_NUM);
120 rgblight_enable_noeeprom();
121 break;
122 case LED_MODE_LOGO:
123 rgblight_set_effect_range(16, 4);
124 rgblight_enable_noeeprom();
125 break;
126 case LED_MODE_UNDERGLOW:
127 rgblight_set_effect_range(0, 16);
128 rgblight_enable_noeeprom();
129 break;
130 case LED_MODE_OFF:
131 rgblight_disable_noeeprom();
132 break;
133 }
134}
135
136void keyboard_post_init_user(void) {
137 user_config.raw = eeconfig_read_user();
138 update_led_mode();
139}
140
141void eeconfig_init_user(void) {
142 user_config.raw = 0;
143 user_config.led_mode = LED_MODE_ALL;
144 eeconfig_update_user(user_config.raw);
145 rgblight_enable();
146}
147
148bool process_record_user(uint16_t keycode, keyrecord_t *record) {
149 static uint32_t key_timer;
150
151 switch (keycode) {
152 // These are the keys we want to 'fall though' and behave as usual when pressed with the alt modifier
153 case KC_A ... KC_Z:
154 case KC_TAB:
155 case KC_DEL:
156 case KC_UP:
157 case KC_DOWN:
158 case KC_ENT:
159 case KC_SPC:
160 case MO(FUNC):
161 if (super_alt_layer_active && record->event.pressed) {
162 // Only activate the alt modifier for the first key press
163 if ((get_mods() & MOD_BIT(KC_LALT)) == false) {
164 register_code(KC_LALT);
165 need_to_unregister_alt = true;
166 }
167 }
168 // We still want to process the keycode normally
169 return true;
170 case KC_F4:
171 // Map alt+shift+4 to alt+f4
172 if (super_alt_layer_active && (get_mods() & MOD_BIT(KC_LSHIFT))) {
173 if (record->event.pressed) {
174 register_code(KC_LALT);
175 } else {
176 unregister_code(KC_LALT);
177 }
178 }
179 return true;
180 case ALT_DEL:
181 if (record->event.pressed) {
182 register_code(KC_DEL);
183 } else {
184 unregister_code(KC_DEL);
185 }
186 return false;
187 case LED_TOG:
188 if (record->event.pressed) {
189 user_config.led_mode = (user_config.led_mode + 1) % LED_MODE_TOTAL;
190 update_led_mode();
191 eeconfig_update_user(user_config.raw);
192 }
193 return false;
194 case RESET:
195 if (record->event.pressed) {
196 key_timer = timer_read32();
197 } else {
198 if (timer_elapsed32(key_timer) >= 500) {
199 reset_keyboard();
200 }
201 }
202 return false;
203 case EEP_RST:
204 if (record->event.pressed) {
205 key_timer = timer_read32();
206 } else {
207 if (timer_elapsed32(key_timer) >= 500) {
208 eeconfig_init();
209 }
210 }
211 return false;
212 default:
213 return true; // Process all other keycodes normally
214 }
215}
diff --git a/keyboards/wuque/ikki68_aurora/keymaps/ewersp/rules.mk b/keyboards/wuque/ikki68_aurora/keymaps/ewersp/rules.mk
new file mode 100644
index 000000000..4da205a16
--- /dev/null
+++ b/keyboards/wuque/ikki68_aurora/keymaps/ewersp/rules.mk
@@ -0,0 +1 @@
LTO_ENABLE = yes