From 1ed03f498fa204178c2696c510ac6a2cd8524e2d Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 26 Nov 2023 18:36:45 +0000 Subject: Remove userspace keymaps (#22544) --- users/arkag/arkag.c | 456 -------------------------------------------------- users/arkag/arkag.h | 105 ------------ users/arkag/config.h | 22 --- users/arkag/readme.md | 42 ----- users/arkag/rules.mk | 4 - 5 files changed, 629 deletions(-) delete mode 100644 users/arkag/arkag.c delete mode 100644 users/arkag/arkag.h delete mode 100644 users/arkag/config.h delete mode 100644 users/arkag/readme.md delete mode 100644 users/arkag/rules.mk (limited to 'users/arkag') diff --git a/users/arkag/arkag.c b/users/arkag/arkag.c deleted file mode 100644 index 7af06acdf1..0000000000 --- a/users/arkag/arkag.c +++ /dev/null @@ -1,456 +0,0 @@ -#include "arkag.h" -#include "eeprom.h" - -/* - Current Layout and Keeb: - https://github.com/arkag/qmk_firmware/blob/master/keyboards/mechmini/v2/keymaps/arkag/keymap.c -*/ - -#include - -// Start: Written by Chris Lewis -#ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) -#endif -#ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - -#define TYPING_SPEED_MAX_VALUE 200 -uint8_t typing_speed = 0; - -void velocikey_accelerate(void) { - if (typing_speed < TYPING_SPEED_MAX_VALUE) typing_speed += (TYPING_SPEED_MAX_VALUE / 50); -} - -void velocikey_decelerate(void) { - static uint16_t decay_timer = 0; - - if (timer_elapsed(decay_timer) > 500 || decay_timer == 0) { - if (typing_speed > 0) typing_speed -= 1; - //Decay a little faster at half of max speed - if (typing_speed > TYPING_SPEED_MAX_VALUE / 2) typing_speed -= 1; - //Decay even faster at 3/4 of max speed - if (typing_speed > TYPING_SPEED_MAX_VALUE / 4 * 3) typing_speed -= 3; - decay_timer = timer_read(); - } -} - -uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) { - return MAX(minValue, maxValue - (maxValue - minValue) * ((float)typing_speed / TYPING_SPEED_MAX_VALUE)); -} -// End: Written by Chris Lewis - -uint8_t current_os, - mod_primary_mask, - fade_interval, - num_extra_flashes_off = 0; -Color underglow, - flash_color, - saved_color, - hsv_none = {0,0,0}; -flashState flash_state = no_flash; -fadeState fade_state = add_fade; -activityState state = boot; - -float song_ussr[][2] = SONG(USSR_ANTHEM); - -void set_color (Color new, bool update) { - rgblight_sethsv_eeprom_helper(new.h, new.s, new.v, update); -} - -void save_color(Color to_save) { - saved_color = to_save; -} - -void reset_color(void) { - underglow = saved_color; -} - -Color mod_color(Color current_color, bool should_add, uint8_t change_amount) { - save_color(underglow); - int addlim = HUE_MAX - change_amount; - int sublim = change_amount; - int leftovers; - if (should_add) { - if (current_color.h <= addlim) { - current_color.h += change_amount; - } else { - leftovers = (HUE_MAX + change_amount) % HUE_MAX; - current_color.h = 0 + leftovers; - } - } else { - if (current_color.h >= sublim) { - current_color.h -= change_amount; - } else { - leftovers = change_amount - current_color.h; - current_color.h = HUE_MAX - leftovers; - } - } - return current_color; -} - -void check_state (void) { - static uint16_t active_timer; - if (!active_timer) {active_timer = timer_read();} - static bool activated, deactivated, slept; - switch (state) { - case active: - if (!activated) { - if (slept) {rgblight_mode_noeeprom(1);} - activated = true; - deactivated = false; - } - fade_interval = velocikey_match_speed(1, 25); - if (timer_elapsed(active_timer) < INACTIVE_DELAY) {return;} - active_timer = timer_read(); - state = inactive; - return; - - case inactive: - if (!deactivated) { - deactivated = true; - activated = false; - } - velocikey_decelerate(); - fade_interval = velocikey_match_speed(1, 25); - return; - - case boot: - return; - } -} - -void fade_rgb (void) { - static uint16_t fade_timer; - if (state == boot) {return;} - if (!fade_timer) {fade_timer = timer_read();} - if (timer_elapsed(fade_timer) < fade_interval) {return;} - switch (fade_state) { - case add_fade: - if (underglow.h == HUE_MAX) { - fade_state = sub_fade; - return; - } - underglow.h = underglow.h + 1; - break; - - case sub_fade: - if (underglow.h == 0) { - fade_state = add_fade; - return; - } - underglow.h = underglow.h - 1; - break; - } - fade_timer = timer_read(); - if (flash_state == no_flash) { - set_color(underglow, false); - } -} - -void flash_rgb (void) { - static uint16_t flash_timer; - switch(flash_state) { - case no_flash: - return; - - case flash_off: - if (!flash_timer) {flash_timer = timer_read();} - if (timer_elapsed(flash_timer) >= LED_FLASH_DELAY) { - set_color(hsv_none, false); - flash_timer = timer_read(); - flash_state = flash_on; - } - return; - - case flash_on: - if (timer_elapsed(flash_timer) >= LED_FLASH_DELAY) { - set_color(flash_color, false); - flash_timer = timer_read(); - if (num_extra_flashes_off > 0) { - flash_state = flash_off; - num_extra_flashes_off--; - } else { - set_color(underglow, false); - flash_state = no_flash; - } - } - return; - } -} - -void set_os (uint8_t os, bool update) { - current_os = os; - if (update) { - eeprom_update_byte(EECONFIG_USERSPACE, current_os); - } - switch (os) { - case OS_MAC: - set_unicode_input_mode(UNICODE_MODE_MACOS); - underglow = (Color){ 213, 255, 255 }; - break; - case OS_WIN: - set_unicode_input_mode(UNICODE_MODE_WINCOMPOSE); - underglow = (Color){ 128, 255, 255 }; - break; - case OS_NIX: - set_unicode_input_mode(UNICODE_MODE_LINUX); - underglow = (Color){ 43, 255, 255 }; - break; - default: - underglow = (Color){ 0, 0, 255 }; - } - set_color(underglow, update); - flash_color = underglow; - flash_state = flash_off; - state = boot; - num_extra_flashes_off = 3; -} - -// register GUI if Mac or Ctrl if other -void pri_mod(bool press) { - if (press) { - if (current_os == OS_MAC) { - register_code(KC_LGUI); - } else { - register_code(KC_LCTL); - } - } else { - if (current_os == OS_MAC) { - unregister_code(KC_LGUI); - } else { - unregister_code(KC_LCTL); - } - } -} - -// register Ctrl if Mac or GUI if other -void sec_mod(bool press) { - if (press) { - if (current_os == OS_MAC) { - register_code(KC_LCTL); - } else { - register_code(KC_LGUI); - } - } else { - if (current_os == OS_MAC) { - unregister_code(KC_LCTL); - } else { - unregister_code(KC_LGUI); - } - } -} - -void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { - if (use_shift) { - register_code(KC_LSFT); - } - for (int i = 0; i < num_of_chars; i++) { - tap_code(keycode); - } - if (use_shift) { - unregister_code(KC_LSFT); - } -} - -void pair_surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { - for (int i = 0; i < num_of_chars; i++) { - (use_shift) ? register_mods(MOD_BIT( KC_LSFT)) : NULL; - tap_code(keycode); - tap_code((keycode == KC_LCBR) ? KC_RCBR : (keycode == KC_LBRC) ? KC_RBRC : (keycode == KC_LPRN) ? KC_RPRN : KC_NO); - (use_shift) ? unregister_mods(MOD_BIT( KC_LSFT)) : NULL; - tap_code(KC_LEFT); - } -} - -void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { - for (int i = 0; i < num_of_chars; i++) { - (use_shift) ? register_mods(MOD_BIT( KC_LSFT)) : NULL; - tap_code(keycode); - (use_shift) ? unregister_mods(MOD_BIT( KC_LSFT)) : NULL; - } - multi_tap(num_of_chars / 2, KC_LEFT, false); -} - -void long_keystroke(size_t num_of_keys, uint16_t keys[]) { - for (int i = 0; i < num_of_keys-1; i++) { - register_code(keys[i]); - } - tap_code(keys[num_of_keys-1]); - for (int i = 0; i < num_of_keys-1; i++) { - unregister_code(keys[i]); - } -} - -void pri_mod_keystroke(uint16_t key) { - pri_mod(true); - tap_code(key); - pri_mod(false); -} - -void leader_end_user(void) { - // begin OS functions - if (leader_sequence_two_keys(KC_P, KC_B)) { - if (current_os == OS_WIN) { - long_keystroke(2, (uint16_t[]){KC_LGUI, KC_PAUSE}); - } else { - return; - } - } - if (leader_sequence_two_keys(KC_S, KC_S)) { - if (current_os == OS_MAC) { - long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_4}); - } else if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LGUI, KC_LSFT, KC_S}); - } else { - return; - } - } - if (leader_sequence_three_keys(KC_C, KC_A, KC_D)) { - if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_DEL}); - } else { - } - } - if (leader_sequence_three_keys(KC_C, KC_A, KC_E)) { - if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LALT, KC_END}); - } else { - } - } - // end OS functions - - // begin format functions - if (leader_sequence_one_key(KC_B)) { - surround_type(2, KC_8, true); - } - if (leader_sequence_one_key(KC_I)) { - surround_type(2, KC_MINS, true); - } - if (leader_sequence_one_key(KC_U)) { - surround_type(4, KC_MINS, true); - } - if (leader_sequence_one_key(KC_S)) { - surround_type(4, KC_GRAVE, true); - } - if (leader_sequence_one_key(KC_C)) { - register_unicode(0x00E7); // ç - } - if (leader_sequence_two_keys(KC_A, KC_V)) { - surround_type(2, KC_QUOT, true); - pair_surround_type(2, KC_LCBR, true); - surround_type(2, KC_SPC, false); - } - if (leader_sequence_two_keys(KC_M, KC_L)) { - pair_surround_type(1, KC_LBRC, false); - SEND_STRING("LINK_NAME"); - tap_code(KC_RGHT); - pair_surround_type(1, KC_LPRN, true); - pri_mod_keystroke(KC_V); - } - if (leader_sequence_two_keys(KC_C, KC_C)) { - surround_type(2, KC_GRAVE, false); - } - if (leader_sequence_three_keys(KC_C, KC_C, KC_C)) { - surround_type(6, KC_GRAVE, false); - } - if (leader_sequence_one_key(KC_E)) { - register_unicode(0x00E8); // è - } - if (leader_sequence_two_keys(KC_E, KC_E)) { - register_unicode(0x00E9); // é - } - // end format functions - - // start fancy functions - if (leader_sequence_two_keys(KC_V, KC_P)) { - SEND_STRING("ggvG}x:set paste\ni"); - pri_mod_keystroke(KC_V); - } - if (leader_sequence_three_keys(KC_C, KC_C, KC_ENT)) { - surround_type(6, KC_GRAVE, false); - pri_mod_keystroke(KC_V); - multi_tap(3, KC_RGHT, false); - tap_code(KC_ENTER); - } - if (leader_sequence_three_keys(KC_T, KC_C, KC_ENT)) { - multi_tap(3, KC_GRAVE, false); - pri_mod_keystroke(KC_V); - multi_tap(2, KC_ENTER, false); - } - // end fancy functions - - // start typing functions - if (leader_sequence_two_keys(KC_T, KC_M)) { - register_unicode(0x2122); // ™ - } - if (leader_sequence_two_keys(KC_D, KC_D)) { - SEND_STRING(".\\Administrator"); - } - if (leader_sequence_three_keys(KC_D, KC_D, KC_D)) { - SEND_STRING(".\\Administrator"); - tap_code(KC_TAB); - pri_mod_keystroke(KC_V); - tap_code(KC_ENTER); - } - if (leader_sequence_three_keys(KC_L, KC_O, KC_D)) { - send_unicode_string("ಠ__ಠ"); - } - if (leader_sequence_three_keys(KC_M, KC_A, KC_P)) { - SEND_STRING("https://github.com/qmk/qmk_firmware/tree/master/users/arkag"); - } - if (leader_sequence_two_keys(KC_F, KC_F)) { - send_unicode_string("(╯‵Д′)╯彡┻━┻"); - } - if (leader_sequence_three_keys(KC_F, KC_F, KC_F)) { - send_unicode_string("┬─┬ノ( º _ º ノ)"); - } - if (leader_sequence_three_keys(KC_L, KC_O, KC_L)) { - send_unicode_string("( ͡° ͜ʖ ͡°)"); - } - if (leader_sequence_three_keys(KC_S, KC_S, KC_S)) { - send_unicode_string("¯\\_(ツ)_/¯"); - } - // end typing functions -} - -void matrix_init_user(void) { - current_os = eeprom_read_byte(EECONFIG_USERSPACE); - set_os(current_os, false); -} - -void matrix_scan_user(void) { - check_state(); - flash_rgb(); - fade_rgb(); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - #ifdef AUDIO_ENABLE - case M_USSR: - PLAY_SONG(song_ussr); - return false; - #endif - - case M_OS: - if (record->event.pressed){ - set_os((current_os+1) % _OS_COUNT, true); - } - return false; - - case M_DASH: - if (record->event.pressed){ - register_unicode(0x2014); // — - } - return false; - - default: - if (record->event.pressed) { - state = active; - velocikey_accelerate(); - } - return true; - } -} diff --git a/users/arkag/arkag.h b/users/arkag/arkag.h deleted file mode 100644 index e127702e94..0000000000 --- a/users/arkag/arkag.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include QMK_KEYBOARD_H - -#define EECONFIG_USERSPACE (uint8_t *)20 - -#define SYMBOL MO(_SYMBOL) -#define MEDIA MO(_MEDIA) -#define ARROW MO(_ARROW) -#define FUNCT MO(_FUNCT) -#define KEEB MO(_KEEB) -#define HITBOX TT(_HITBOX) - -#define LED_FLASH_DELAY 150 - -#define ACCEL_DELAY 500 -#define DEACCEL_DELAY 500 - -#define INACTIVE_DELAY 250 -#define SLEEP_DELAY 180000 - -#define HUE_MAX 254 - -enum { - _QWERTY = 0, - _SYMBOL, - _MEDIA, - _ARROW, - _FUNCT, - _KEEB, - _HITBOX, -}; - -typedef enum { - OS_MAC, // Don't assign values - OS_WIN, - OS_NIX, - _OS_COUNT, -} OS; - -typedef struct { - uint16_t h; - uint8_t s; - uint8_t v; -} Color; - -typedef enum { - no_flash = 0, - flash_off, - flash_on, -} flashState; - -typedef enum { - add_fade = 0, - sub_fade, -} fadeState; - -typedef enum { - active = 0, - inactive, - boot, -} activityState; - -enum custom_keycodes { - M_PMOD = SAFE_RANGE, - M_SMOD, - M_OS, - M_DASH, - M_USSR, -}; - -void velocikey_accelerate(void); -void velocikey_decelerate(void); -uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue); - -void set_color (Color new, bool update); -void save_color(Color to_save); -void reset_color(void); - -Color mod_color(Color current_color, bool should_add, uint8_t change_amount); - -void reverse_fade (void); - -void check_state (void); - -void fade_rgb (void); - -void flash_rgb (void); - -void set_os (uint8_t os, bool update); - -void tap_key(uint8_t keycode); - -void pri_mod(bool press); - -void sec_mod(bool press); - -void meh_hyper(bool press); - -void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift); - -void surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift); -void pair_surround_type(uint8_t num_of_chars, uint16_t keycode, bool use_shift); - -void long_keystroke(size_t num_of_keys, uint16_t keys[]); diff --git a/users/arkag/config.h b/users/arkag/config.h deleted file mode 100644 index 7dccac7a85..0000000000 --- a/users/arkag/config.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2021 Alex Kagno - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -#pragma once - -#define TAPPING_TERM 200 -#define LEADER_TIMEOUT 300 - -#define LEADER_PER_KEY_TIMING diff --git a/users/arkag/readme.md b/users/arkag/readme.md deleted file mode 100644 index c685892f86..0000000000 --- a/users/arkag/readme.md +++ /dev/null @@ -1,42 +0,0 @@ -# Shot on Pixel 2 XL with Cheap Lamp at Work - -![mmm, tasty](mechmini2.jpg) - -# I don't know what I'm doing - -Some links: -* [Layout File: Mech Mini 2](layout_mm2) -* [Userspace Header](arkag_h) -* [Userspace Main](arkag_c) - -Here's a list of some things I have working with my currently [keyboard](mm2_home): - -* Reactive (sort of) fading while typing, ported from [Velocikey](https://github.com/qmk/qmk_firmware/pull/3754). -* OS Switching, storing to EEPROM -* OS Specific Macros and Shortcuts(WIN+SHIFT+S for Windows and CMD+SHIFT+4 for MacOS) -* Flashing RGB LED on OS change -* Hex Unicode Macros dependent on OS(half works on Windows due to [WinCompose](https://github.com/SamHocevar/wincompose) not functioning properly just yet). -* "Sleep" function activates after 3 minutes (breathing). -* Markdown style macros for surround type __eve__ ~~ryw~~ *her* **eee** (apparently only certain places support underline and strikethrough ಠ__ಠ) - -# License Stuff - -Copyright 2018 arkag arkag@pm.me - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - -[arkag_c]: /users/arkag/arkag.c -[arkag_h]: /users/arkag/arkag.h -[layout_mm2]: /keyboards/mechmini/v2/keymaps/arkag/keymap.c -[mm2_home]: https://cartel.ltd/projects/mechmini2/ diff --git a/users/arkag/rules.mk b/users/arkag/rules.mk deleted file mode 100644 index 14d60970b3..0000000000 --- a/users/arkag/rules.mk +++ /dev/null @@ -1,4 +0,0 @@ -SRC += arkag.c - -# save me space! -LTO_ENABLE = yes \ No newline at end of file -- cgit v1.2.3