aboutsummaryrefslogtreecommitdiff
path: root/users/arkag
diff options
context:
space:
mode:
Diffstat (limited to 'users/arkag')
-rw-r--r--users/arkag/arkag.c144
-rw-r--r--users/arkag/arkag.h16
-rw-r--r--users/arkag/config.h16
-rw-r--r--users/arkag/rules.mk5
4 files changed, 115 insertions, 66 deletions
diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c
index 97f84d8f0..564c234c3 100644
--- a/users/arkag/arkag.c
+++ b/users/arkag/arkag.c
@@ -1,4 +1,5 @@
1#include "arkag.h" 1#include "arkag.h"
2#include "eeprom.h"
2 3
3/* 4/*
4 Current Layout and Keeb: 5 Current Layout and Keeb:
@@ -40,6 +41,7 @@ uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) {
40} 41}
41// End: Written by Chris Lewis 42// End: Written by Chris Lewis
42 43
44static int shift_int = 0;
43uint8_t current_os, 45uint8_t current_os,
44 mod_primary_mask, 46 mod_primary_mask,
45 fade_interval, 47 fade_interval,
@@ -54,6 +56,8 @@ activityState state = boot;
54bool aesthetic = false, 56bool aesthetic = false,
55 shifty = false; 57 shifty = false;
56 58
59float song_ussr[][2] = SONG(USSR_ANTHEM);
60
57void set_color (Color new, bool update) { 61void set_color (Color new, bool update) {
58 rgblight_sethsv_eeprom_helper(new.h, new.s, new.v, update); 62 rgblight_sethsv_eeprom_helper(new.h, new.s, new.v, update);
59} 63}
@@ -188,21 +192,17 @@ void set_os (uint8_t os, bool update) {
188 case OS_MAC: 192 case OS_MAC:
189 set_unicode_input_mode(UC_OSX); 193 set_unicode_input_mode(UC_OSX);
190 underglow = (Color){ 213, 255, 255 }; 194 underglow = (Color){ 213, 255, 255 };
191 mod_primary_mask = MOD_GUI_MASK;
192 break; 195 break;
193 case OS_WIN: 196 case OS_WIN:
194 set_unicode_input_mode(UC_WINC); 197 set_unicode_input_mode(UC_WINC);
195 underglow = (Color){ 128, 255, 255 }; 198 underglow = (Color){ 128, 255, 255 };
196 mod_primary_mask = MOD_CTL_MASK;
197 break; 199 break;
198 case OS_NIX: 200 case OS_NIX:
199 set_unicode_input_mode(UC_LNX); 201 set_unicode_input_mode(UC_LNX);
200 underglow = (Color){ 43, 255, 255 }; 202 underglow = (Color){ 43, 255, 255 };
201 mod_primary_mask = MOD_CTL_MASK;
202 break; 203 break;
203 default: 204 default:
204 underglow = (Color){ 0, 0, 255 }; 205 underglow = (Color){ 0, 0, 255 };
205 mod_primary_mask = MOD_CTL_MASK;
206 } 206 }
207 set_color(underglow, update); 207 set_color(underglow, update);
208 flash_color = underglow; 208 flash_color = underglow;
@@ -245,6 +245,17 @@ void sec_mod(bool press) {
245 } 245 }
246} 246}
247 247
248// register Meh if Win or Hyper if other
249// KC_MEH/HYPR registers both sides, causes issues with some apps
250// I'll do it myself, then
251void meh_hyper(bool press) {
252 if (current_os == OS_WIN) {
253 (press) ? register_mods(L_BIT_MEH) : unregister_mods(L_BIT_MEH);
254 } else {
255 (press) ? register_mods(L_BIT_HYPR) : unregister_mods(L_BIT_HYPR);
256 }
257}
258
248void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { 259void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) {
249 if (use_shift) { 260 if (use_shift) {
250 register_code(KC_LSFT); 261 register_code(KC_LSFT);
@@ -257,21 +268,25 @@ void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) {
257 } 268 }
258} 269}
259 270
260void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { 271void pair_surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) {
261 if (use_shift) {
262 register_code(KC_LSFT);
263 }
264 for (int i = 0; i < num_of_chars; i++) { 272 for (int i = 0; i < num_of_chars; i++) {
273 (use_shift) ? register_mods(MOD_BIT( KC_LSFT)) : NULL;
265 tap_code(keycode); 274 tap_code(keycode);
266 } 275 tap_code((keycode == KC_LCBR) ? KC_RCBR : (keycode == KC_LBRC) ? KC_RBRC : (keycode == KC_LPRN) ? KC_RPRN : KC_NO);
267 if (use_shift) { 276 (use_shift) ? unregister_mods(MOD_BIT( KC_LSFT)) : NULL;
268 unregister_code(KC_LSFT);
269 }
270 for (int i = 0; i < (num_of_chars/2); i++) {
271 tap_code(KC_LEFT); 277 tap_code(KC_LEFT);
272 } 278 }
273} 279}
274 280
281void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) {
282 for (int i = 0; i < num_of_chars; i++) {
283 (use_shift) ? register_mods(MOD_BIT( KC_LSFT)) : NULL;
284 tap_code(keycode);
285 (use_shift) ? unregister_mods(MOD_BIT( KC_LSFT)) : NULL;
286 }
287 multi_tap(num_of_chars / 2, KC_LEFT, false);
288}
289
275void long_keystroke(size_t num_of_keys, uint16_t keys[]) { 290void long_keystroke(size_t num_of_keys, uint16_t keys[]) {
276 for (int i = 0; i < num_of_keys-1; i++) { 291 for (int i = 0; i < num_of_keys-1; i++) {
277 register_code(keys[i]); 292 register_code(keys[i]);
@@ -282,6 +297,12 @@ void long_keystroke(size_t num_of_keys, uint16_t keys[]) {
282 } 297 }
283} 298}
284 299
300void pri_mod_keystroke(uint16_t key) {
301 pri_mod(true);
302 tap_code(key);
303 pri_mod(false);
304}
305
285void matrix_init_user(void) { 306void matrix_init_user(void) {
286 current_os = eeprom_read_byte(EECONFIG_USERSPACE); 307 current_os = eeprom_read_byte(EECONFIG_USERSPACE);
287 set_os(current_os, false); 308 set_os(current_os, false);
@@ -326,27 +347,14 @@ void matrix_scan_user(void) {
326 } else { 347 } else {
327 } 348 }
328 } 349 }
329 SEQ_THREE_KEYS(KC_C, KC_S, KC_E) {
330 if (current_os == OS_WIN) {
331 long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LSFT, KC_ESC});
332 } else {
333 }
334 }
335 SEQ_FOUR_KEYS(KC_C, KC_A, KC_L, KC_C) {
336 if (current_os == OS_WIN) {
337 SEND_STRING(SS_TAP(X_CALCULATOR));
338 } else if (current_os == OS_MAC) {
339 SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI) "calculator" SS_TAP(X_ENTER));
340 }
341 }
342 // end OS functions 350 // end OS functions
343 351
344 // begin format functions 352 // begin format functions
345 SEQ_ONE_KEY(KC_B) { 353 SEQ_ONE_KEY(KC_B) {
346 surround_type(4, KC_8, true); 354 surround_type(2, KC_8, true);
347 } 355 }
348 SEQ_ONE_KEY(KC_I) { 356 SEQ_ONE_KEY(KC_I) {
349 surround_type(2, KC_8, true); 357 surround_type(2, KC_MINS, true);
350 } 358 }
351 SEQ_ONE_KEY(KC_U) { 359 SEQ_ONE_KEY(KC_U) {
352 surround_type(4, KC_MINS, true); 360 surround_type(4, KC_MINS, true);
@@ -357,6 +365,18 @@ void matrix_scan_user(void) {
357 SEQ_ONE_KEY(KC_C) { 365 SEQ_ONE_KEY(KC_C) {
358 send_unicode_hex_string("00E7"); 366 send_unicode_hex_string("00E7");
359 } 367 }
368 SEQ_TWO_KEYS(KC_A, KC_V) {
369 surround_type(2, KC_QUOT, true);
370 pair_surround_type(2, KC_LCBR, true);
371 surround_type(2, KC_SPC, false);
372 }
373 SEQ_TWO_KEYS(KC_M, KC_L) {
374 pair_surround_type(1, KC_LBRC, false);
375 SEND_STRING("LINK_NAME");
376 tap_code(KC_RGHT);
377 pair_surround_type(1, KC_LPRN, true);
378 pri_mod_keystroke(KC_V);
379 }
360 SEQ_TWO_KEYS(KC_C, KC_C) { 380 SEQ_TWO_KEYS(KC_C, KC_C) {
361 surround_type(2, KC_GRAVE, false); 381 surround_type(2, KC_GRAVE, false);
362 } 382 }
@@ -369,28 +389,18 @@ void matrix_scan_user(void) {
369 SEQ_TWO_KEYS(KC_E, KC_E) { 389 SEQ_TWO_KEYS(KC_E, KC_E) {
370 send_unicode_hex_string("00E9"); 390 send_unicode_hex_string("00E9");
371 } 391 }
372 SEQ_TWO_KEYS(KC_T, KC_I) {
373 surround_type(4, KC_MINS, true);
374 }
375 SEQ_TWO_KEYS(KC_T, KC_B) {
376 surround_type(4, KC_8, true);
377 }
378 // end format functions 392 // end format functions
379 393
380 // start fancy functions 394 // start fancy functions
381 SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) { 395 SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) {
382 surround_type(6, KC_GRAVE, false); 396 surround_type(6, KC_GRAVE, false);
383 pri_mod(true); 397 pri_mod_keystroke(KC_V);
384 tap_code(KC_V);
385 pri_mod(false);
386 multi_tap(3, KC_RGHT, false); 398 multi_tap(3, KC_RGHT, false);
387 tap_code(KC_ENTER); 399 tap_code(KC_ENTER);
388 } 400 }
389 SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) { 401 SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) {
390 multi_tap(3, KC_GRAVE, false); 402 multi_tap(3, KC_GRAVE, false);
391 pri_mod(true); 403 pri_mod_keystroke(KC_V);
392 tap_code(KC_V);
393 pri_mod(false);
394 multi_tap(2, KC_ENTER, false); 404 multi_tap(2, KC_ENTER, false);
395 } 405 }
396 // end fancy functions 406 // end fancy functions
@@ -406,9 +416,7 @@ void matrix_scan_user(void) {
406 SEQ_THREE_KEYS(KC_D, KC_D, KC_D) { 416 SEQ_THREE_KEYS(KC_D, KC_D, KC_D) {
407 SEND_STRING(".\\Administrator"); 417 SEND_STRING(".\\Administrator");
408 tap_code(KC_TAB); 418 tap_code(KC_TAB);
409 pri_mod(true); 419 pri_mod_keystroke(KC_V);
410 tap_code(KC_V);
411 pri_mod(false);
412 tap_code(KC_ENTER); 420 tap_code(KC_ENTER);
413 } 421 }
414 SEQ_THREE_KEYS(KC_L, KC_O, KC_D) { 422 SEQ_THREE_KEYS(KC_L, KC_O, KC_D) {
@@ -426,7 +434,7 @@ void matrix_scan_user(void) {
426 // ┬─┬ノ( º _ º ノ) 434 // ┬─┬ノ( º _ º ノ)
427 send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029"); 435 send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029");
428 } 436 }
429 SEQ_THREE_KEYS(KC_L, KC_E, KC_N) { 437 SEQ_THREE_KEYS(KC_L, KC_O, KC_L) {
430 // ( ͡° ͜ʖ ͡°) 438 // ( ͡° ͜ʖ ͡°)
431 send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029"); 439 send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029");
432 } 440 }
@@ -469,18 +477,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
469 switch (keycode) { 477 switch (keycode) {
470 case KC_A ... KC_Z: 478 case KC_A ... KC_Z:
471 if (record->event.pressed) { 479 if (record->event.pressed) {
472 static int shift_int = 1; 480 shift_int += (rand() % 5);
473 int shift = shift_int % 2; 481 int shift = ((shift_int % 2) == 1) ? true : false;
474 shift_int++;
475 state = active; 482 state = active;
476 velocikey_accelerate(); 483 velocikey_accelerate();
477 if (shift == 1){ 484 (shift) ? register_code(KC_LSFT) : NULL;
478 register_code(KC_LSFT);
479 }
480 tap_code(keycode); 485 tap_code(keycode);
481 if (shift == 1){ 486 (shift) ? unregister_code(KC_LSFT) : NULL;
482 unregister_code(KC_LSFT);
483 }
484 } 487 }
485 return false; 488 return false;
486 case KC_SPC: 489 case KC_SPC:
@@ -496,13 +499,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
496 } 499 }
497 500
498 switch (keycode) { 501 switch (keycode) {
499 case M_PMOD: 502 #ifdef AUDIO_ENABLE
500 pri_mod(record->event.pressed); 503 case M_USSR:
501 return false; 504 PLAY_SONG(song_ussr);
502 505 return false;
503 case M_SMOD: 506 #endif
504 sec_mod(record->event.pressed);
505 return false;
506 507
507 case M_OS: 508 case M_OS:
508 if (record->event.pressed){ 509 if (record->event.pressed){
@@ -515,6 +516,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
515 send_unicode_hex_string("2014"); 516 send_unicode_hex_string("2014");
516 } 517 }
517 return false; 518 return false;
519 case M_LMHYP:
520 case M_EHYPR:
521 (keycode = M_LMHYP) ? (record->event.pressed) ? layer_on(_ARROW) : layer_off(_ARROW) : NULL;
522 meh_hyper(record->event.pressed);
523 return false;
524
525 case M_SFTY:
526 if(record->event.pressed){
527 num_extra_flashes_off = (shifty) ? 1 : 0;
528 shifty = !shifty;
529 flash_color = underglow;
530 flash_state = flash_off;
531 return false;
532 }
533
534 case M_AEST:
535 if(record->event.pressed){
536 num_extra_flashes_off = (aesthetic) ? 1 : 0;
537 aesthetic = !aesthetic;
538 flash_color = underglow;
539 flash_state = flash_off;
540 return false;
541 }
518 542
519 default: 543 default:
520 if (record->event.pressed) { 544 if (record->event.pressed) {
diff --git a/users/arkag/arkag.h b/users/arkag/arkag.h
index b78234ca9..d4bec6598 100644
--- a/users/arkag/arkag.h
+++ b/users/arkag/arkag.h
@@ -1,7 +1,6 @@
1#pragma once 1#pragma once
2 2
3#include "quantum.h" 3#include QMK_KEYBOARD_H
4#include "process_keycode/process_tap_dance.h"
5 4
6#define EECONFIG_USERSPACE (uint8_t *)20 5#define EECONFIG_USERSPACE (uint8_t *)20
7 6
@@ -11,9 +10,8 @@
11#define FUNCT MO(4) 10#define FUNCT MO(4)
12#define KEEB MO(5) 11#define KEEB MO(5)
13 12
14#define MOD_CTL_MASK (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) 13#define L_BIT_MEH MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LSFT)
15#define MOD_GUI_MASK (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) 14#define L_BIT_HYPR MOD_BIT(KC_LCTL) | MOD_BIT(KC_LGUI) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LSFT)
16#define MOD_SFT_MASK (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))
17 15
18#define LED_FLASH_DELAY 150 16#define LED_FLASH_DELAY 150
19 17
@@ -69,6 +67,11 @@ enum custom_keycodes {
69 M_SMOD, 67 M_SMOD,
70 M_OS, 68 M_OS,
71 M_DASH, 69 M_DASH,
70 M_USSR,
71 M_EHYPR,
72 M_LMHYP,
73 M_SFTY,
74 M_AEST,
72}; 75};
73 76
74void velocikey_accelerate(void); 77void velocikey_accelerate(void);
@@ -97,8 +100,11 @@ void pri_mod(bool press);
97 100
98void sec_mod(bool press); 101void sec_mod(bool press);
99 102
103void meh_hyper(bool press);
104
100void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift); 105void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift);
101 106
102void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift); 107void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift);
108void pair_surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift);
103 109
104void long_keystroke(size_t num_of_keys, uint16_t keys[]); 110void long_keystroke(size_t num_of_keys, uint16_t keys[]);
diff --git a/users/arkag/config.h b/users/arkag/config.h
index 5a89a18f6..7dccac7a8 100644
--- a/users/arkag/config.h
+++ b/users/arkag/config.h
@@ -1,3 +1,19 @@
1/* Copyright 2021 Alex Kagno
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
1#pragma once 17#pragma once
2 18
3#define TAPPING_TERM 200 19#define TAPPING_TERM 200
diff --git a/users/arkag/rules.mk b/users/arkag/rules.mk
index 3513f0ea6..14d60970b 100644
--- a/users/arkag/rules.mk
+++ b/users/arkag/rules.mk
@@ -1 +1,4 @@
1 SRC += arkag.c 1SRC += arkag.c
2
3# save me space!
4LTO_ENABLE = yes \ No newline at end of file