diff --git a/keyboards/mechmini/v2/keymaps/arkag/config.h b/keyboards/mechmini/v2/keymaps/arkag/config.h index e89adc097..966289459 100644 --- a/keyboards/mechmini/v2/keymaps/arkag/config.h +++ b/keyboards/mechmini/v2/keymaps/arkag/config.h @@ -1,3 +1,19 @@ +/* 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 // save me space! diff --git a/keyboards/mechmini/v2/keymaps/arkag/keymap.c b/keyboards/mechmini/v2/keymaps/arkag/keymap.c index ee1afff05..2c64c5aac 100644 --- a/keyboards/mechmini/v2/keymaps/arkag/keymap.c +++ b/keyboards/mechmini/v2/keymaps/arkag/keymap.c @@ -1,4 +1,19 @@ -#include QMK_KEYBOARD_H +/* 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 . +*/ + #include "arkag.h" /* diff --git a/keyboards/mechmini/v2/keymaps/arkag/rules.mk b/keyboards/mechmini/v2/keymaps/arkag/rules.mk index d46e72f75..c4ee1a7d7 100644 --- a/keyboards/mechmini/v2/keymaps/arkag/rules.mk +++ b/keyboards/mechmini/v2/keymaps/arkag/rules.mk @@ -12,6 +12,3 @@ RGBLIGHT_ENABLE = yes TAP_DANCE_ENABLE = no UNICODE_ENABLE = yes LEADER_ENABLE = yes - -# save me space! -EXTRAFLAGS += -flto diff --git a/keyboards/preonic/keymaps/arkag/config.h b/keyboards/preonic/keymaps/arkag/config.h new file mode 100644 index 000000000..1b42e6ef9 --- /dev/null +++ b/keyboards/preonic/keymaps/arkag/config.h @@ -0,0 +1,30 @@ +/* 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 + +#ifdef AUDIO_ENABLE +# define STARTUP_SONG SONG(STARTUP_SOUND) +# define GOODBYE_SONG SONG(GOODBYE_SOUND) +# define AUDIO_CLICKY +# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.0f +# define MIDI_BASIC +# define MUSIC_MASK keycode != KC_NO +#endif + +// save me space! +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION diff --git a/keyboards/preonic/keymaps/arkag/keymap.c b/keyboards/preonic/keymaps/arkag/keymap.c new file mode 100644 index 000000000..42b875d67 --- /dev/null +++ b/keyboards/preonic/keymaps/arkag/keymap.c @@ -0,0 +1,77 @@ +/* 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 . +*/ + +#include "arkag.h" +#include "muse.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_preonic_grid( + M_EHYPR, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, M_EHYPR, + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, + KC_LCTL, KC_LGUI, KC_LALT, MEDIA, SYMBOL, KC_SPC, M_LMHYP, ARROW, FUNCT, XXXXXXX, KC_RALT, KC_LEAD), + + [_SYMBOL] = LAYOUT_preonic_grid( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_GRV, KC_LPRN, KC_RPRN, KC_PLUS, KC_UNDS, KC_CIRC, KC_AMPR, KC_7, KC_8, KC_9, _______, _______, + KC_LCBR, KC_LBRC, KC_RBRC, KC_EQL, KC_MINS, KC_ASTR, KC_PIPE, KC_4, KC_5, KC_6, _______, KC_NLCK, + KC_RCBR, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_PDOT, KC_1, KC_2, KC_3, KC_BSLS, KC_PENT, + M_DASH, KC_TILD, _______, KEEB, _______, _______, _______, KC_0, KC_PSLS, KC_PMNS, KC_PPLS, KC_PAST), + + [_MEDIA] = LAYOUT_preonic_grid( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_MPRV, KC_VOLD, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, + KC_MPLY, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_ARROW] = LAYOUT_preonic_grid( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_UP, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + + [_FUNCT] = LAYOUT_preonic_grid( + 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_HOME, _______, _______, _______, _______, _______, + M_SFTY, _______, _______, KC_CALC, _______, _______, _______, _______, _______, _______, _______, KC_CAPS, + _______, _______, _______, _______, _______, _______, M_AEST, _______, _______, _______, _______, M_OS ), + + [_KEEB] = LAYOUT_preonic_grid( + CK_TOGG, AU_TOG, MU_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, + M_USSR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, BL_TOGG, BL_STEP, BL_INC, BL_DEC, BL_BRTG, _______, _______, _______, _______, _______, _______, + RGB_M_P, RGB_TOG, RGB_MOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, _______, _______, _______, + RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), + +}; + +#ifdef AUDIO_ENABLE +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case MU_TOG: + case SYMBOL: + case KEEB: + return false; + default: + return true; + } +} +#endif diff --git a/keyboards/preonic/keymaps/arkag/readme.md b/keyboards/preonic/keymaps/arkag/readme.md new file mode 100644 index 000000000..e911968dd --- /dev/null +++ b/keyboards/preonic/keymaps/arkag/readme.md @@ -0,0 +1 @@ +# The default Preonic layout - largely based on the Planck's \ No newline at end of file diff --git a/keyboards/preonic/keymaps/arkag/rules.mk b/keyboards/preonic/keymaps/arkag/rules.mk new file mode 100644 index 000000000..8b04cf2aa --- /dev/null +++ b/keyboards/preonic/keymaps/arkag/rules.mk @@ -0,0 +1,17 @@ +BOOTMAGIC_ENABLE = lite +MOUSEKEY_ENABLE = no +STENO_ENABLE = no +EXTRAKEY_ENABLE = yes +CONSOLE_ENABLE = no +COMMAND_ENABLE = no +SLEEP_LED_ENABLE = yes +NKRO_ENABLE = yes +BACKLIGHT_ENABLE = no +AUDIO_ENABLE = yes +RGBLIGHT_ENABLE = yes +TAP_DANCE_ENABLE = no +UNICODE_ENABLE = yes +LEADER_ENABLE = yes + +# from default +SRC += muse.c 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 @@ #include "arkag.h" +#include "eeprom.h" /* Current Layout and Keeb: @@ -40,6 +41,7 @@ uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) { } // End: Written by Chris Lewis +static int shift_int = 0; uint8_t current_os, mod_primary_mask, fade_interval, @@ -54,6 +56,8 @@ activityState state = boot; bool aesthetic = false, shifty = false; +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); } @@ -188,21 +192,17 @@ void set_os (uint8_t os, bool update) { case OS_MAC: set_unicode_input_mode(UC_OSX); underglow = (Color){ 213, 255, 255 }; - mod_primary_mask = MOD_GUI_MASK; break; case OS_WIN: set_unicode_input_mode(UC_WINC); underglow = (Color){ 128, 255, 255 }; - mod_primary_mask = MOD_CTL_MASK; break; case OS_NIX: set_unicode_input_mode(UC_LNX); underglow = (Color){ 43, 255, 255 }; - mod_primary_mask = MOD_CTL_MASK; break; default: underglow = (Color){ 0, 0, 255 }; - mod_primary_mask = MOD_CTL_MASK; } set_color(underglow, update); flash_color = underglow; @@ -245,6 +245,17 @@ void sec_mod(bool press) { } } +// register Meh if Win or Hyper if other +// KC_MEH/HYPR registers both sides, causes issues with some apps +// I'll do it myself, then +void meh_hyper(bool press) { + if (current_os == OS_WIN) { + (press) ? register_mods(L_BIT_MEH) : unregister_mods(L_BIT_MEH); + } else { + (press) ? register_mods(L_BIT_HYPR) : unregister_mods(L_BIT_HYPR); + } +} + void multi_tap(uint8_t num_of_chars, uint16_t keycode, bool use_shift) { if (use_shift) { register_code(KC_LSFT); @@ -257,21 +268,25 @@ 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) { - if (use_shift) { - register_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); - } - if (use_shift) { - unregister_code(KC_LSFT); - } - for (int i = 0; i < (num_of_chars/2); i++) { + 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]); @@ -282,6 +297,12 @@ void long_keystroke(size_t num_of_keys, uint16_t keys[]) { } } +void pri_mod_keystroke(uint16_t key) { + pri_mod(true); + tap_code(key); + pri_mod(false); +} + void matrix_init_user(void) { current_os = eeprom_read_byte(EECONFIG_USERSPACE); set_os(current_os, false); @@ -326,27 +347,14 @@ void matrix_scan_user(void) { } else { } } - SEQ_THREE_KEYS(KC_C, KC_S, KC_E) { - if (current_os == OS_WIN) { - long_keystroke(3, (uint16_t[]){KC_LCTL, KC_LSFT, KC_ESC}); - } else { - } - } - SEQ_FOUR_KEYS(KC_C, KC_A, KC_L, KC_C) { - if (current_os == OS_WIN) { - SEND_STRING(SS_TAP(X_CALCULATOR)); - } else if (current_os == OS_MAC) { - SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI) "calculator" SS_TAP(X_ENTER)); - } - } // end OS functions // begin format functions SEQ_ONE_KEY(KC_B) { - surround_type(4, KC_8, true); + surround_type(2, KC_8, true); } SEQ_ONE_KEY(KC_I) { - surround_type(2, KC_8, true); + surround_type(2, KC_MINS, true); } SEQ_ONE_KEY(KC_U) { surround_type(4, KC_MINS, true); @@ -357,6 +365,18 @@ void matrix_scan_user(void) { SEQ_ONE_KEY(KC_C) { send_unicode_hex_string("00E7"); } + SEQ_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); + } + SEQ_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); + } SEQ_TWO_KEYS(KC_C, KC_C) { surround_type(2, KC_GRAVE, false); } @@ -369,28 +389,18 @@ void matrix_scan_user(void) { SEQ_TWO_KEYS(KC_E, KC_E) { send_unicode_hex_string("00E9"); } - SEQ_TWO_KEYS(KC_T, KC_I) { - surround_type(4, KC_MINS, true); - } - SEQ_TWO_KEYS(KC_T, KC_B) { - surround_type(4, KC_8, true); - } // end format functions // start fancy functions SEQ_THREE_KEYS(KC_C, KC_C, KC_ENT) { surround_type(6, KC_GRAVE, false); - pri_mod(true); - tap_code(KC_V); - pri_mod(false); + pri_mod_keystroke(KC_V); multi_tap(3, KC_RGHT, false); tap_code(KC_ENTER); } SEQ_THREE_KEYS(KC_T, KC_C, KC_ENT) { multi_tap(3, KC_GRAVE, false); - pri_mod(true); - tap_code(KC_V); - pri_mod(false); + pri_mod_keystroke(KC_V); multi_tap(2, KC_ENTER, false); } // end fancy functions @@ -406,9 +416,7 @@ void matrix_scan_user(void) { SEQ_THREE_KEYS(KC_D, KC_D, KC_D) { SEND_STRING(".\\Administrator"); tap_code(KC_TAB); - pri_mod(true); - tap_code(KC_V); - pri_mod(false); + pri_mod_keystroke(KC_V); tap_code(KC_ENTER); } SEQ_THREE_KEYS(KC_L, KC_O, KC_D) { @@ -426,7 +434,7 @@ void matrix_scan_user(void) { // ┬─┬ノ( º _ º ノ) send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 0020 30CE 0029"); } - SEQ_THREE_KEYS(KC_L, KC_E, KC_N) { + SEQ_THREE_KEYS(KC_L, KC_O, KC_L) { // ( ͡° ͜ʖ ͡°) send_unicode_hex_string("0028 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029"); } @@ -469,18 +477,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_A ... KC_Z: if (record->event.pressed) { - static int shift_int = 1; - int shift = shift_int % 2; - shift_int++; + shift_int += (rand() % 5); + int shift = ((shift_int % 2) == 1) ? true : false; state = active; velocikey_accelerate(); - if (shift == 1){ - register_code(KC_LSFT); - } + (shift) ? register_code(KC_LSFT) : NULL; tap_code(keycode); - if (shift == 1){ - unregister_code(KC_LSFT); - } + (shift) ? unregister_code(KC_LSFT) : NULL; } return false; case KC_SPC: @@ -496,13 +499,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } switch (keycode) { - case M_PMOD: - pri_mod(record->event.pressed); - return false; - - case M_SMOD: - sec_mod(record->event.pressed); - return false; + #ifdef AUDIO_ENABLE + case M_USSR: + PLAY_SONG(song_ussr); + return false; + #endif case M_OS: if (record->event.pressed){ @@ -515,6 +516,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { send_unicode_hex_string("2014"); } return false; + case M_LMHYP: + case M_EHYPR: + (keycode = M_LMHYP) ? (record->event.pressed) ? layer_on(_ARROW) : layer_off(_ARROW) : NULL; + meh_hyper(record->event.pressed); + return false; + + case M_SFTY: + if(record->event.pressed){ + num_extra_flashes_off = (shifty) ? 1 : 0; + shifty = !shifty; + flash_color = underglow; + flash_state = flash_off; + return false; + } + + case M_AEST: + if(record->event.pressed){ + num_extra_flashes_off = (aesthetic) ? 1 : 0; + aesthetic = !aesthetic; + flash_color = underglow; + flash_state = flash_off; + return false; + } default: 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 @@ #pragma once -#include "quantum.h" -#include "process_keycode/process_tap_dance.h" +#include QMK_KEYBOARD_H #define EECONFIG_USERSPACE (uint8_t *)20 @@ -11,9 +10,8 @@ #define FUNCT MO(4) #define KEEB MO(5) -#define MOD_CTL_MASK (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) -#define MOD_GUI_MASK (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI)) -#define MOD_SFT_MASK (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) +#define L_BIT_MEH MOD_BIT(KC_LCTL) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LSFT) +#define L_BIT_HYPR MOD_BIT(KC_LCTL) | MOD_BIT(KC_LGUI) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LSFT) #define LED_FLASH_DELAY 150 @@ -69,6 +67,11 @@ enum custom_keycodes { M_SMOD, M_OS, M_DASH, + M_USSR, + M_EHYPR, + M_LMHYP, + M_SFTY, + M_AEST, }; void velocikey_accelerate(void); @@ -97,8 +100,11 @@ 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 index 5a89a18f6..7dccac7a8 100644 --- a/users/arkag/config.h +++ b/users/arkag/config.h @@ -1,3 +1,19 @@ +/* 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 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 @@ - SRC += arkag.c +SRC += arkag.c + +# save me space! +LTO_ENABLE = yes \ No newline at end of file