2020-09-22 07:12:29 +02:00
|
|
|
/* Copyright 2020 Rustam Zagirov
|
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
#define KC_MAC_UNDO LGUI(KC_Z)
|
|
|
|
#define KC_MAC_CUT LGUI(KC_X)
|
|
|
|
#define KC_MAC_COPY LGUI(KC_C)
|
|
|
|
#define KC_MAC_PASTE LGUI(KC_V)
|
|
|
|
#define KC_PC_UNDO LCTL(KC_Z)
|
|
|
|
#define KC_PC_CUT LCTL(KC_X)
|
|
|
|
#define KC_PC_COPY LCTL(KC_C)
|
|
|
|
#define KC_PC_PASTE LCTL(KC_V)
|
2021-07-06 01:05:11 +02:00
|
|
|
#define ES_LABK_MAC KC_GRAVE
|
|
|
|
#define ES_RABK_MAC LSFT(KC_GRAVE)
|
2020-09-22 07:12:29 +02:00
|
|
|
#define ES_BSLS_MAC ALGR(KC_6)
|
|
|
|
#define NO_PIPE_ALT KC_GRAVE
|
|
|
|
#define NO_BSLS_ALT KC_EQUAL
|
|
|
|
#define LSA_T(kc) MT(MOD_LSFT | MOD_LALT, kc)
|
|
|
|
|
2020-12-23 06:34:33 +01:00
|
|
|
#define E_NUMBERS LT(_1_NUMBERS, KC_E)
|
|
|
|
#define R_MOUSE LT(_2_MOUSE, KC_R)
|
|
|
|
|
|
|
|
#define ARROWS MO(_3_ARROW)
|
2020-09-22 07:12:29 +02:00
|
|
|
|
|
|
|
enum custom_keycodes {
|
|
|
|
RGB_SLD = EZ_SAFE_RANGE,
|
|
|
|
ALT_TAB,
|
|
|
|
};
|
|
|
|
|
|
|
|
bool is_alt_tab_active = false; // ADD this near the begining of keymap.c
|
|
|
|
uint16_t alt_tab_timer = 0; // we will be using them soon.
|
|
|
|
|
|
|
|
enum layers {
|
|
|
|
_0_BASE,
|
2020-12-23 06:34:33 +01:00
|
|
|
_1_NUMBERS,
|
|
|
|
_2_MOUSE,
|
|
|
|
_3_ARROW,
|
2020-09-22 07:12:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
|
|
[_0_BASE] = LAYOUT_ergodox(
|
2022-10-10 21:06:26 +02:00
|
|
|
KC_NUBS, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_AUDIO_MUTE,
|
2022-10-21 15:25:54 +02:00
|
|
|
QK_LEAD, KC_Q, KC_W, E_NUMBERS, R_MOUSE, KC_T, XXXXXXX,
|
2020-12-23 06:34:33 +01:00
|
|
|
LCTL(KC_B), LSFT_T(KC_A), LCTL_T(KC_S), LALT_T(KC_D), LGUI_T(KC_F), KC_G,
|
2022-10-13 19:28:14 +02:00
|
|
|
KC_BSLS, KC_Z, KC_X, KC_C, KC_V, KC_B, XXXXXXX,
|
2020-12-23 06:34:33 +01:00
|
|
|
ALT_TAB, XXXXXXX, XXXXXXX, MO(_1_NUMBERS), ARROWS,
|
2020-09-22 07:12:29 +02:00
|
|
|
KC_AUDIO_VOL_DOWN, KC_AUDIO_VOL_UP,
|
|
|
|
XXXXXXX,
|
|
|
|
KC_ENTER, KC_TAB, KC_ESCAPE,
|
2022-10-10 21:06:26 +02:00
|
|
|
KC_CAPS, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_MINUS,
|
|
|
|
XXXXXXX, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,
|
2022-10-13 19:28:14 +02:00
|
|
|
KC_H, RGUI_T(KC_J), RALT_T(KC_K), RCTL_T(KC_L), RSFT_T(KC_SCLN), KC_QUOTE,
|
2022-10-10 21:06:26 +02:00
|
|
|
KC_RBRC, KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_EQUAL,
|
2020-12-23 06:34:33 +01:00
|
|
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
2020-09-22 07:12:29 +02:00
|
|
|
KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK,
|
|
|
|
XXXXXXX,
|
2022-10-13 19:28:14 +02:00
|
|
|
KC_ESCAPE, KC_BSPC, KC_SPACE
|
2020-09-22 07:12:29 +02:00
|
|
|
),
|
2020-12-23 06:34:33 +01:00
|
|
|
[_1_NUMBERS] = LAYOUT_ergodox(
|
2020-09-22 07:12:29 +02:00
|
|
|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
2022-08-22 00:55:30 +02:00
|
|
|
QK_BOOT, _______, _______, _______, _______,
|
2020-09-22 07:12:29 +02:00
|
|
|
_______, _______,
|
|
|
|
_______,
|
|
|
|
_______, _______, _______,
|
|
|
|
|
|
|
|
_______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
|
|
|
|
_______, _______, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
|
|
|
|
_______, KC_4, KC_5, KC_6, KC_PLUS, _______,
|
2022-10-13 19:28:14 +02:00
|
|
|
_______, _______, KC_1, KC_2, KC_3, KC_BSLS, _______,
|
2020-09-22 07:12:29 +02:00
|
|
|
KC_0, KC_KP_DOT, _______, KC_EQUAL, _______,
|
|
|
|
_______, _______,
|
|
|
|
_______,
|
|
|
|
_______, _______, _______
|
|
|
|
),
|
2020-12-23 06:34:33 +01:00
|
|
|
[_2_MOUSE] = LAYOUT_ergodox(
|
2020-09-22 07:12:29 +02:00
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______,
|
|
|
|
|
|
|
|
RGB_HUI, RGB_HUD,
|
|
|
|
_______,
|
|
|
|
_______, _______, _______,
|
|
|
|
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
RGB_MOD, RGB_TOG, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, _______, _______,
|
|
|
|
RGB_SLD, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, _______, _______,
|
|
|
|
TOGGLE_LAYER_COLOR, _______, KC_MS_WH_UP, _______, KC_MS_WH_DOWN, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______,
|
|
|
|
|
|
|
|
RGB_VAD, RGB_VAI,
|
|
|
|
_______,
|
2020-12-23 06:34:33 +01:00
|
|
|
_______, _______, _______
|
|
|
|
),
|
|
|
|
[_3_ARROW] = LAYOUT_ergodox(
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______,
|
|
|
|
|
|
|
|
_______, _______,
|
|
|
|
_______,
|
|
|
|
_______, _______, _______,
|
|
|
|
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______, _______, _______,
|
|
|
|
_______, _______, _______, _______, _______,
|
|
|
|
|
2020-09-22 07:12:29 +02:00
|
|
|
_______, _______,
|
2020-12-23 06:34:33 +01:00
|
|
|
_______,
|
|
|
|
_______, _______, _______
|
2020-09-22 07:12:29 +02:00
|
|
|
),
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* bool suspended = false; */
|
2020-12-23 06:34:33 +01:00
|
|
|
void keyboard_post_init_user(void) {
|
|
|
|
rgblight_disable();
|
|
|
|
}
|
2020-09-22 07:12:29 +02:00
|
|
|
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
switch (keycode) {
|
|
|
|
case RGB_SLD:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
rgblight_mode(1);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case ALT_TAB:
|
|
|
|
if (record->event.pressed) {
|
|
|
|
if (!is_alt_tab_active) {
|
|
|
|
is_alt_tab_active = true;
|
|
|
|
register_code(KC_LGUI);
|
|
|
|
}
|
|
|
|
alt_tab_timer = timer_read();
|
|
|
|
register_code(KC_TAB);
|
|
|
|
} else {
|
|
|
|
unregister_code(KC_TAB);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
|
|
|
ergodox_led_all_off();
|
2020-12-23 06:34:33 +01:00
|
|
|
/* rgblight_disable(); */
|
2020-09-22 07:12:29 +02:00
|
|
|
switch (get_highest_layer(state)) {
|
2020-12-23 06:34:33 +01:00
|
|
|
case _1_NUMBERS:
|
2020-09-22 07:12:29 +02:00
|
|
|
ergodox_right_led_1_on();
|
2020-12-23 06:34:33 +01:00
|
|
|
/* rgblight_enable();
|
|
|
|
rgblight_mode(1);
|
|
|
|
rgblight_sethsv(HSV_BLUE);*/
|
2020-09-22 07:12:29 +02:00
|
|
|
break;
|
2020-12-23 06:34:33 +01:00
|
|
|
case _2_MOUSE:
|
2020-09-22 07:12:29 +02:00
|
|
|
ergodox_right_led_2_on();
|
|
|
|
break;
|
2020-12-23 06:34:33 +01:00
|
|
|
case _3_ARROW:
|
2020-09-22 07:12:29 +02:00
|
|
|
ergodox_right_led_3_on();
|
|
|
|
break;
|
|
|
|
/* case 7: */
|
|
|
|
/* ergodox_right_led_1_on(); */
|
|
|
|
/* ergodox_right_led_2_on(); */
|
|
|
|
/* ergodox_right_led_3_on(); */
|
|
|
|
/* break; */
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return state;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
switch (keycode) {
|
|
|
|
/* case SFT_T(KC_SPC): */
|
|
|
|
/* return TAPPING_TERM + 1250; */
|
2020-12-23 06:34:33 +01:00
|
|
|
case E_NUMBERS:
|
2020-09-22 07:12:29 +02:00
|
|
|
return 200;
|
2020-12-23 06:34:33 +01:00
|
|
|
case LT(_2_MOUSE, KC_R):
|
2020-09-22 07:12:29 +02:00
|
|
|
return 200;
|
|
|
|
/* case LGUI_T(KC_F): */
|
|
|
|
/* return 50; */
|
|
|
|
default:
|
|
|
|
return TAPPING_TERM;
|
|
|
|
}
|
|
|
|
}
|
2022-12-13 12:20:07 +01:00
|
|
|
bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
|
2020-09-22 07:12:29 +02:00
|
|
|
switch (keycode) {
|
2020-12-23 06:34:33 +01:00
|
|
|
case E_NUMBERS:
|
|
|
|
case R_MOUSE:
|
2020-09-22 07:12:29 +02:00
|
|
|
case LSFT_T(KC_A):
|
|
|
|
case LCTL_T(KC_S):
|
|
|
|
case LALT_T(KC_D):
|
|
|
|
case LGUI_T(KC_F):
|
|
|
|
case RGUI_T(KC_J):
|
|
|
|
case RALT_T(KC_K):
|
|
|
|
case RCTL_T(KC_L):
|
2022-10-13 19:28:14 +02:00
|
|
|
case RSFT_T(KC_SEMICOLON):
|
2020-12-23 06:34:33 +01:00
|
|
|
case ARROWS:
|
2022-12-13 12:20:07 +01:00
|
|
|
return false;
|
2020-09-22 07:12:29 +02:00
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-12 16:52:22 +01:00
|
|
|
uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
switch (keycode) {
|
|
|
|
case LT(_1_NUMBERS, KC_E):
|
|
|
|
case R_MOUSE:
|
|
|
|
case LSFT_T(KC_A):
|
|
|
|
case LCTL_T(KC_S):
|
|
|
|
case LALT_T(KC_D):
|
|
|
|
case LGUI_T(KC_F):
|
|
|
|
case RGUI_T(KC_J):
|
|
|
|
case RALT_T(KC_K):
|
|
|
|
case RCTL_T(KC_L):
|
|
|
|
case RSFT_T(KC_SEMICOLON):
|
|
|
|
case ARROWS:
|
|
|
|
return QUICK_TAP_TERM;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
2020-09-22 07:12:29 +02:00
|
|
|
}
|
|
|
|
|
2023-02-12 17:19:02 +01:00
|
|
|
void leader_end_user(void) {
|
|
|
|
if (leader_sequence_one_key(KC_F)) {
|
|
|
|
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
|
|
|
}
|
|
|
|
if (leader_sequence_one_key(KC_S)) {
|
|
|
|
SEND_STRING ("sudo -i\n");
|
|
|
|
}
|
|
|
|
if (leader_sequence_one_key(KC_H)) {
|
|
|
|
SEND_STRING ("--help\n");
|
|
|
|
}
|
|
|
|
if (leader_sequence_two_keys(KC_D, KC_D)) {
|
|
|
|
SEND_STRING(SS_LGUI("ac"));
|
|
|
|
/* SEND_STRING(SS_LGUI("a") SS_LGUI("c")); */
|
|
|
|
}
|
|
|
|
if (leader_sequence_three_keys(KC_D, KC_D, KC_S)) {
|
|
|
|
SEND_STRING("https://start.duckduckgo.com\n");
|
|
|
|
}
|
|
|
|
if (leader_sequence_two_keys(KC_A, KC_S)) {
|
|
|
|
register_code(KC_LGUI);
|
|
|
|
register_code(KC_S);
|
|
|
|
unregister_code(KC_S);
|
|
|
|
unregister_code(KC_LGUI);
|
|
|
|
}
|
|
|
|
}
|
2020-09-22 07:12:29 +02:00
|
|
|
|
|
|
|
void matrix_scan_user(void) {
|
|
|
|
if (is_alt_tab_active) {
|
|
|
|
if (timer_elapsed(alt_tab_timer) > 1000) {
|
|
|
|
unregister_code(KC_LGUI);
|
|
|
|
is_alt_tab_active = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|