Merge remote-tracking branch 'origin/master' into develop
commit
e80c50967b
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define UNICODE_SELECTED_MODES UC_MAC, UC_LNX
|
||||||
|
|
||||||
|
#define MOUSEKEY_INTERVAL 12
|
||||||
|
#define MOUSEKEY_MAX_SPEED 6
|
||||||
|
#define MOUSEKEY_TIME_TO_MAX 50
|
||||||
|
|
||||||
|
#define MOUSEKEY_DELAY 20
|
||||||
|
// It makes sense to use the same delay for the mouseweel
|
||||||
|
#define MOUSEKEY_WHEEL_DELAY 100
|
||||||
|
// The default is 100
|
||||||
|
#define MOUSEKEY_WHEEL_INTERVAL 50
|
||||||
|
// The default is 40
|
||||||
|
#define MOUSEKEY_WHEEL_TIME_TO_MAX 100
|
|
@ -0,0 +1,349 @@
|
||||||
|
/* Copyright 2021 @daliusd
|
||||||
|
*
|
||||||
|
* 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 "oneshot.h"
|
||||||
|
|
||||||
|
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||||
|
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||||
|
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||||
|
// entirely and just use numbers.
|
||||||
|
enum layers {
|
||||||
|
_QWERTY,
|
||||||
|
_SYM,
|
||||||
|
_NAV,
|
||||||
|
_NUMB,
|
||||||
|
_TMUX,
|
||||||
|
_MOUSE,
|
||||||
|
_MISC,
|
||||||
|
_FUNC,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
TM_NEXT = SAFE_RANGE,
|
||||||
|
TM_PREV,
|
||||||
|
TM_LEFT,
|
||||||
|
TM_RIGHT,
|
||||||
|
TM_NEW,
|
||||||
|
TM_SLCT,
|
||||||
|
TM_SRCH,
|
||||||
|
TM_URL,
|
||||||
|
OS_CTRL,
|
||||||
|
OS_ALT,
|
||||||
|
OS_GUI,
|
||||||
|
OS_TMUX,
|
||||||
|
OS_MISC,
|
||||||
|
OS_FUNC,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Shortcut to make keymap more readable
|
||||||
|
|
||||||
|
#define L_NAV MO(_NAV)
|
||||||
|
#define L_SYM MO(_SYM)
|
||||||
|
#define L_MOUSE TG(_MOUSE)
|
||||||
|
|
||||||
|
#define K_PRINT (QK_LCTL | QK_LSFT | QK_LGUI | KC_4)
|
||||||
|
|
||||||
|
enum unicode_names {
|
||||||
|
SNEK,
|
||||||
|
EURO,
|
||||||
|
LT_S_A,
|
||||||
|
LT_L_A,
|
||||||
|
LT_S_C,
|
||||||
|
LT_L_C,
|
||||||
|
LT_S_E1,
|
||||||
|
LT_L_E1,
|
||||||
|
LT_S_E2,
|
||||||
|
LT_L_E2,
|
||||||
|
LT_S_I,
|
||||||
|
LT_L_I,
|
||||||
|
LT_S_S,
|
||||||
|
LT_L_S,
|
||||||
|
LT_S_U1,
|
||||||
|
LT_L_U1,
|
||||||
|
LT_S_U2,
|
||||||
|
LT_L_U2,
|
||||||
|
LT_S_Z,
|
||||||
|
LT_L_Z,
|
||||||
|
LT_OB,
|
||||||
|
LT_CB,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint32_t PROGMEM unicode_map[] = {
|
||||||
|
[SNEK] = 0x1F40D, // 🐍
|
||||||
|
[EURO] = 0x20ac, // €
|
||||||
|
[LT_S_A] = 0x105, // ą
|
||||||
|
[LT_L_A] = 0x104, // Ą
|
||||||
|
[LT_S_C] = 0x10d, // č
|
||||||
|
[LT_L_C] = 0x10c, // Č
|
||||||
|
[LT_S_E1] = 0x119, // ę
|
||||||
|
[LT_L_E1] = 0x118, // Ę
|
||||||
|
[LT_S_E2] = 0x117, // ė
|
||||||
|
[LT_L_E2] = 0x116, // Ė
|
||||||
|
[LT_S_I] = 0x12f, // į
|
||||||
|
[LT_L_I] = 0x12e, // Į
|
||||||
|
[LT_S_S] = 0x161, // š
|
||||||
|
[LT_L_S] = 0x160, // Š'
|
||||||
|
[LT_S_U1] = 0x173, // ų
|
||||||
|
[LT_L_U1] = 0x172, // Ų
|
||||||
|
[LT_S_U2] = 0x16b, // ū
|
||||||
|
[LT_L_U2] = 0x16a, // Ū
|
||||||
|
[LT_S_Z] = 0x17e, // ž
|
||||||
|
[LT_L_Z] = 0x17d, // Ž
|
||||||
|
[LT_OB] = 0x201e, // „
|
||||||
|
[LT_CB] = 0x201c, // “
|
||||||
|
};
|
||||||
|
|
||||||
|
#define K_SNEK X(SNEK)
|
||||||
|
#define K_EURO X(EURO)
|
||||||
|
#define K_LT_A XP(LT_S_A, LT_L_A)
|
||||||
|
#define K_LT_C XP(LT_S_C, LT_L_C)
|
||||||
|
#define K_LT_E1 XP(LT_S_E1, LT_L_E1)
|
||||||
|
#define K_LT_E2 XP(LT_S_E2, LT_L_E2)
|
||||||
|
#define K_LT_I XP(LT_S_I, LT_L_I)
|
||||||
|
#define K_LT_S XP(LT_S_S, LT_L_S)
|
||||||
|
#define K_LT_U1 XP(LT_S_U1, LT_L_U1)
|
||||||
|
#define K_LT_U2 XP(LT_S_U2, LT_L_U2)
|
||||||
|
#define K_LT_Z XP(LT_S_Z, LT_L_Z)
|
||||||
|
#define K_LT_OB X(LT_OB)
|
||||||
|
#define K_LT_CB X(LT_CB)
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_QWERTY] = LAYOUT(
|
||||||
|
//┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
|
||||||
|
KC_Q ,KC_W ,KC_E ,KC_R ,KC_T, KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
KC_A ,KC_S ,KC_D ,KC_F ,KC_G , KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
KC_Z ,KC_X ,KC_C ,KC_V ,KC_B , KC_N ,KC_M ,KC_COMM ,KC_DOT ,KC_SLSH,
|
||||||
|
//└────────┴────────┴────────┴────┬───┴────┬───┼────────┐ ┌────────┼───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
|
L_NAV , KC_SPC , KC_LSFT , L_SYM
|
||||||
|
// └────────┘ └────────┘ └────────┘ └────────┘
|
||||||
|
),
|
||||||
|
|
||||||
|
[_SYM] = LAYOUT(
|
||||||
|
//┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
|
||||||
|
KC_EXLM ,KC_AT ,KC_HASH ,KC_DLR ,KC_PERC , KC_CIRC ,KC_AMPR ,KC_ASTR ,KC_LPRN ,KC_RPRN ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
KC_GRV ,KC_PLUS ,KC_LBRC ,KC_RBRC ,K_LT_OB , KC_MINS ,OS_ALT ,OS_CTRL ,OS_GUI ,KC_PIPE ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
K_SNEK ,KC_EQL ,KC_LCBR ,KC_RCBR ,K_LT_CB , KC_UNDS ,KC_QUOT ,KC_DQT ,K_EURO ,KC_BSLS ,
|
||||||
|
//└────────┴────────┴────────┴────┬───┴────┬───┼────────┐ ┌────────┼───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
|
_______ , _______ , _______ , _______
|
||||||
|
// └────────┘ └────────┘ └────────┘ └────────┘
|
||||||
|
),
|
||||||
|
|
||||||
|
[_NAV] = LAYOUT(
|
||||||
|
//┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
|
||||||
|
KC_TILDE,L_MOUSE ,OS_FUNC ,OS_MISC ,OS_TMUX , K_LT_A ,K_LT_C ,K_LT_E1 ,K_LT_E2 ,K_LT_I ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
KC_TAB ,OS_GUI ,OS_CTRL ,OS_ALT ,KC_ENT , KC_LEFT ,KC_DOWN ,KC_UP ,KC_RIGHT,KC_END ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
KC_DELT ,KC_BSPC ,KC_ESC ,KC_PGDN ,KC_PGUP , KC_HOME ,K_LT_S ,K_LT_U1 ,K_LT_U2 ,K_LT_Z ,
|
||||||
|
//└────────┴────────┴────────┴────┬───┴────┬───┼────────┐ ┌────────┼───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
|
_______ , _______ , _______ , _______
|
||||||
|
// └────────┘ └────────┘ └────────┘ └────────┘
|
||||||
|
),
|
||||||
|
|
||||||
|
[_NUMB] = LAYOUT(
|
||||||
|
//┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
|
||||||
|
KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 , XXXXXXX ,OS_ALT ,OS_CTRL ,OS_GUI ,XXXXXXX ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
KC_DELT ,KC_BSPC ,XXXXXXX ,XXXXXXX ,XXXXXXX , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,
|
||||||
|
//└────────┴────────┴────────┴────┬───┴────┬───┼────────┐ ┌────────┼───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
|
_______ , _______ , _______ , _______
|
||||||
|
// └────────┘ └────────┘ └────────┘ └────────┘
|
||||||
|
),
|
||||||
|
|
||||||
|
[_TMUX] = LAYOUT(
|
||||||
|
//┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
|
||||||
|
XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , XXXXXXX ,TM_URL ,XXXXXXX ,XXXXXXX ,XXXXXXX ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , TM_LEFT ,TM_NEXT ,TM_PREV ,TM_RIGHT,XXXXXXX ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , TM_NEW ,TM_SLCT ,XXXXXXX ,XXXXXXX ,TM_SRCH ,
|
||||||
|
//└────────┴────────┴────────┴────┬───┴────┬───┼────────┐ ┌────────┼───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
|
XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
|
||||||
|
// └────────┘ └────────┘ └────────┘ └────────┘
|
||||||
|
),
|
||||||
|
|
||||||
|
[_MOUSE] = LAYOUT(
|
||||||
|
//┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
|
||||||
|
XXXXXXX ,L_MOUSE ,KC_MS_U ,KC_BTN3 ,KC_WH_U , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
XXXXXXX ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_WH_D , XXXXXXX ,KC_LALT ,KC_LCTL ,KC_LGUI ,XXXXXXX ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
XXXXXXX ,XXXXXXX ,KC_ESC ,XXXXXXX ,XXXXXXX , XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,
|
||||||
|
//└────────┴────────┴────────┴────┬───┴────┬───┼────────┐ ┌────────┼───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
|
KC_BTN1 , KC_BTN2 , XXXXXXX , XXXXXXX
|
||||||
|
// └────────┘ └────────┘ └────────┘ └────────┘
|
||||||
|
),
|
||||||
|
|
||||||
|
[_MISC] = LAYOUT(
|
||||||
|
//┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
|
||||||
|
RESET ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , KC_BRID ,KC_BRIU ,XXXXXXX ,KC_PSCR ,K_PRINT ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
XXXXXXX ,XXXXXXX ,DEBUG ,XXXXXXX ,XXXXXXX , KC_MPRV ,KC_MPLY ,XXXXXXX ,KC_MNXT ,XXXXXXX ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , KC_VOLD ,KC_VOLU ,XXXXXXX ,XXXXXXX ,UC_MOD ,
|
||||||
|
//└────────┴────────┴────────┴────┬───┴────┬───┼────────┐ ┌────────┼───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
|
XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
|
||||||
|
// └────────┘ └────────┘ └────────┘ └────────┘
|
||||||
|
),
|
||||||
|
|
||||||
|
[_FUNC] = LAYOUT(
|
||||||
|
//┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
|
||||||
|
XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,
|
||||||
|
//├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
|
||||||
|
XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX ,XXXXXXX , KC_F11 ,KC_F12 ,XXXXXXX ,XXXXXXX ,XXXXXXX ,
|
||||||
|
//└────────┴────────┴────────┴────┬───┴────┬───┼────────┐ ┌────────┼───┬────┴───┬────┴────────┴────────┴────────┘
|
||||||
|
XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX
|
||||||
|
// └────────┘ └────────┘ └────────┘ └────────┘
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TMUX_PREFIX SS_DOWN(X_LCTL) "b" SS_UP(X_LCTL)
|
||||||
|
|
||||||
|
bool is_oneshot_cancel_key(uint16_t keycode) {
|
||||||
|
switch (keycode) {
|
||||||
|
case L_SYM:
|
||||||
|
case L_NAV:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_oneshot_layer_cancel_key(uint16_t keycode) {
|
||||||
|
switch (keycode) {
|
||||||
|
case L_SYM:
|
||||||
|
case L_NAV:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_oneshot_ignored_key(uint16_t keycode) {
|
||||||
|
switch (keycode) {
|
||||||
|
case L_SYM:
|
||||||
|
case L_NAV:
|
||||||
|
case OS_CTRL:
|
||||||
|
case OS_ALT:
|
||||||
|
case OS_GUI:
|
||||||
|
case OS_TMUX:
|
||||||
|
case OS_MISC:
|
||||||
|
case KC_LSFT:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_oneshot_mod_key(uint16_t keycode) {
|
||||||
|
switch (keycode) {
|
||||||
|
case OS_CTRL:
|
||||||
|
case OS_ALT:
|
||||||
|
case OS_GUI:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oneshot_state os_ctrl_state = os_up_unqueued;
|
||||||
|
oneshot_state os_alt_state = os_up_unqueued;
|
||||||
|
oneshot_state os_cmd_state = os_up_unqueued;
|
||||||
|
oneshot_state os_tmux_state = os_up_unqueued;
|
||||||
|
oneshot_state os_misc_state = os_up_unqueued;
|
||||||
|
oneshot_state os_func_state = os_up_unqueued;
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
update_oneshot(
|
||||||
|
&os_ctrl_state, KC_LCTL, OS_CTRL,
|
||||||
|
keycode, record
|
||||||
|
);
|
||||||
|
update_oneshot(
|
||||||
|
&os_alt_state, KC_LALT, OS_ALT,
|
||||||
|
keycode, record
|
||||||
|
);
|
||||||
|
update_oneshot(
|
||||||
|
&os_cmd_state, KC_LGUI, OS_GUI,
|
||||||
|
keycode, record
|
||||||
|
);
|
||||||
|
|
||||||
|
bool handled = true;
|
||||||
|
handled = update_oneshot_layer(
|
||||||
|
&os_tmux_state, _TMUX, OS_TMUX,
|
||||||
|
keycode, record
|
||||||
|
) & handled;
|
||||||
|
|
||||||
|
handled = update_oneshot_layer(
|
||||||
|
&os_misc_state, _MISC, OS_MISC,
|
||||||
|
keycode, record
|
||||||
|
) & handled;
|
||||||
|
|
||||||
|
handled = update_oneshot_layer(
|
||||||
|
&os_func_state, _FUNC, OS_FUNC,
|
||||||
|
keycode, record
|
||||||
|
) & handled;
|
||||||
|
if (!handled) return false;
|
||||||
|
|
||||||
|
switch (keycode) {
|
||||||
|
case TM_LEFT:
|
||||||
|
if (!record->event.pressed) return true;
|
||||||
|
SEND_STRING(TMUX_PREFIX "<");
|
||||||
|
return false;
|
||||||
|
case TM_RIGHT:
|
||||||
|
if (!record->event.pressed) return true;
|
||||||
|
SEND_STRING(TMUX_PREFIX ">");
|
||||||
|
return false;
|
||||||
|
case TM_NEXT:
|
||||||
|
if (!record->event.pressed) return true;
|
||||||
|
SEND_STRING(TMUX_PREFIX "n");
|
||||||
|
return false;
|
||||||
|
case TM_PREV:
|
||||||
|
if (!record->event.pressed) return true;
|
||||||
|
SEND_STRING(TMUX_PREFIX "p");
|
||||||
|
return false;
|
||||||
|
case TM_NEW:
|
||||||
|
if (!record->event.pressed) return true;
|
||||||
|
SEND_STRING(TMUX_PREFIX "c");
|
||||||
|
return false;
|
||||||
|
case TM_SLCT:
|
||||||
|
if (!record->event.pressed) return true;
|
||||||
|
SEND_STRING(TMUX_PREFIX "[");
|
||||||
|
return false;
|
||||||
|
case TM_SRCH:
|
||||||
|
if (!record->event.pressed) return true;
|
||||||
|
SEND_STRING(TMUX_PREFIX "\t");
|
||||||
|
return false;
|
||||||
|
case TM_URL:
|
||||||
|
if (!record->event.pressed) return true;
|
||||||
|
SEND_STRING(TMUX_PREFIX SS_LCTL("u"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
|
return update_tri_layer_state(state, _SYM, _NAV, _NUMB);
|
||||||
|
}
|
|
@ -0,0 +1,195 @@
|
||||||
|
/* Copyright 2021 @daliusd
|
||||||
|
*
|
||||||
|
* 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 "print.h"
|
||||||
|
#include "oneshot.h"
|
||||||
|
|
||||||
|
void update_oneshot(
|
||||||
|
oneshot_state *state,
|
||||||
|
uint16_t mod,
|
||||||
|
uint16_t trigger,
|
||||||
|
uint16_t keycode,
|
||||||
|
keyrecord_t *record
|
||||||
|
) {
|
||||||
|
if (keycode == trigger) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
// Trigger keydown
|
||||||
|
if (*state == os_up_unqueued) {
|
||||||
|
register_code(mod);
|
||||||
|
}
|
||||||
|
*state = os_down_unused;
|
||||||
|
dprintf("trigger down (on?), mod: %d, ? -> os_down_unused\n", mod);
|
||||||
|
} else {
|
||||||
|
// Trigger keyup
|
||||||
|
switch (*state) {
|
||||||
|
case os_down_unused:
|
||||||
|
// If we didn't use the mod while trigger was held, queue it.
|
||||||
|
*state = os_up_queued;
|
||||||
|
dprintf("trigger up, mod: %d, os_down_unused -> os_up_queued\n", mod);
|
||||||
|
break;
|
||||||
|
case os_down_used:
|
||||||
|
// If we did use the mod while trigger was held, unregister it.
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
unregister_code(mod);
|
||||||
|
dprintf("trigger up (off), mod: %d, os_down_used -> os_up_unqueued\n", mod);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
if (is_oneshot_cancel_key(keycode) && *state != os_up_unqueued) {
|
||||||
|
// Cancel oneshot on designated cancel keydown.
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
unregister_code(mod);
|
||||||
|
dprintf("cancel (off), mod: %d, ? -> os_up_unqueued\n", mod);
|
||||||
|
}
|
||||||
|
if (!is_oneshot_ignored_key(keycode)) {
|
||||||
|
switch (*state) {
|
||||||
|
case os_up_queued:
|
||||||
|
*state = os_up_queued_used;
|
||||||
|
dprintf("key up (off), mod: %d, os_up_queued -> os_up_queued_used\n", mod);
|
||||||
|
break;
|
||||||
|
case os_up_queued_used:
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
unregister_code(mod);
|
||||||
|
dprintf("key up (off), mod: %d, os_up_queued_used -> os_up_unqueued\n", mod);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!is_oneshot_ignored_key(keycode)) {
|
||||||
|
// On non-ignored keyup, consider the oneshot used.
|
||||||
|
switch (*state) {
|
||||||
|
case os_down_unused:
|
||||||
|
*state = os_down_used;
|
||||||
|
dprintf("key up, mod: %d, os_down_unused -> os_down_used\n", mod);
|
||||||
|
break;
|
||||||
|
case os_up_queued:
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
unregister_code(mod);
|
||||||
|
dprintf("key up (off), mod: %d, os_up_queued -> os_up_unqueued\n", mod);
|
||||||
|
break;
|
||||||
|
case os_up_queued_used:
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
unregister_code(mod);
|
||||||
|
dprintf("key up (off), mod: %d, os_up_queued_used -> os_up_unqueued\n", mod);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool update_oneshot_layer(
|
||||||
|
oneshot_state *state,
|
||||||
|
uint16_t layer,
|
||||||
|
uint16_t trigger,
|
||||||
|
uint16_t keycode,
|
||||||
|
keyrecord_t *record
|
||||||
|
) {
|
||||||
|
if (keycode == trigger) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
// Trigger keydown
|
||||||
|
if (*state == os_up_unqueued) {
|
||||||
|
layer_on(layer);
|
||||||
|
}
|
||||||
|
*state = os_down_unused;
|
||||||
|
dprintf("trigger down (on?), layer: %d, ? -> os_down_unused\n", layer);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// Trigger keyup
|
||||||
|
switch (*state) {
|
||||||
|
case os_down_unused:
|
||||||
|
// If we didn't use the layer while trigger was held, queue it.
|
||||||
|
*state = os_up_queued;
|
||||||
|
dprintf("trigger up, layer: %d, os_down_unused -> os_up_queued\n", layer);
|
||||||
|
return false;
|
||||||
|
case os_down_used:
|
||||||
|
// If we did use the layer while trigger was held, turn off it.
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
layer_off(layer);
|
||||||
|
dprintf("trigger up (off), layer: %d, os_down_used -> os_up_unqueued\n", layer);
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
if (is_oneshot_layer_cancel_key(keycode) && *state != os_up_unqueued) {
|
||||||
|
// Cancel oneshot layer on designated cancel keydown.
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
layer_off(layer);
|
||||||
|
dprintf("cancel (off), layer: %d, ? -> os_up_unqueued\n", layer);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
uint8_t key_layer = read_source_layers_cache(record->event.key);
|
||||||
|
if (key_layer == layer) {
|
||||||
|
// On non-ignored keyup, consider the oneshot used.
|
||||||
|
switch (*state) {
|
||||||
|
case os_down_unused:
|
||||||
|
*state = os_down_used;
|
||||||
|
dprintf("key down, layer: %d, os_down_unused -> os_down_used\n", layer);
|
||||||
|
return true;
|
||||||
|
case os_up_queued:
|
||||||
|
if (is_oneshot_mod_key(keycode)) {
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
layer_off(layer);
|
||||||
|
dprintf("key down, layer: %d, os_up_queued -> os_up_unqueued\n", layer);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
*state = os_up_queued_used;
|
||||||
|
dprintf("key down, layer: %d, os_up_queued -> os_up_queued_used\n", layer);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case os_up_queued_used:
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
layer_off(layer);
|
||||||
|
dprintf("key down (off), layer: %d, os_up_queued_used -> os_up_unqueued\n", layer);
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Ignore key ups from other layers
|
||||||
|
uint8_t key_layer = read_source_layers_cache(record->event.key);
|
||||||
|
if (key_layer == layer) {
|
||||||
|
// On non-ignored keyup, consider the oneshot used.
|
||||||
|
switch (*state) {
|
||||||
|
case os_up_queued:
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
layer_off(layer);
|
||||||
|
dprintf("key up (off), layer: %d, os_up_queued -> os_up_unqueued\n", layer);
|
||||||
|
return true;
|
||||||
|
case os_up_queued_used:
|
||||||
|
*state = os_up_unqueued;
|
||||||
|
layer_off(layer);
|
||||||
|
dprintf("key up (off), layer: %d, os_up_queued_used -> os_up_unqueued\n", layer);
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
/* Copyright 2021 @daliusd
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
// Represents the four states a oneshot key can be in
|
||||||
|
typedef enum {
|
||||||
|
os_up_unqueued,
|
||||||
|
os_up_queued,
|
||||||
|
os_up_queued_used,
|
||||||
|
os_down_unused,
|
||||||
|
os_down_used,
|
||||||
|
} oneshot_state;
|
||||||
|
|
||||||
|
// Custom oneshot mod implementation that doesn't rely on timers. If a mod is
|
||||||
|
// used while it is held it will be unregistered on keyup as normal, otherwise
|
||||||
|
// it will be queued and only released after the next non-mod keyup.
|
||||||
|
void update_oneshot(
|
||||||
|
oneshot_state *state,
|
||||||
|
uint16_t mod,
|
||||||
|
uint16_t trigger,
|
||||||
|
uint16_t keycode,
|
||||||
|
keyrecord_t *record
|
||||||
|
);
|
||||||
|
|
||||||
|
// Oneshot implementation for layers
|
||||||
|
bool update_oneshot_layer(
|
||||||
|
oneshot_state *state,
|
||||||
|
uint16_t layer,
|
||||||
|
uint16_t trigger,
|
||||||
|
uint16_t keycode,
|
||||||
|
keyrecord_t *record
|
||||||
|
);
|
||||||
|
|
||||||
|
// To be implemented by the consumer. Layers one shot implementation needs to
|
||||||
|
// know which keys are used as oneshot mods
|
||||||
|
bool is_oneshot_mod_key(
|
||||||
|
uint16_t keycode
|
||||||
|
);
|
||||||
|
|
||||||
|
// To be implemented by the consumer. Defines keys to cancel oneshot mods.
|
||||||
|
bool is_oneshot_cancel_key(uint16_t keycode);
|
||||||
|
|
||||||
|
// To be implemented by the consumer. Defines keys to cancel oneshot layers.
|
||||||
|
bool is_oneshot_layer_cancel_key(uint16_t keycode);
|
||||||
|
|
||||||
|
// To be implemented by the consumer. Defines keys to ignore when determining
|
||||||
|
// whether a oneshot mod has been used. Setting this to modifiers and layer
|
||||||
|
// change keys allows stacking multiple oneshot modifiers, and carrying them
|
||||||
|
// between layers.
|
||||||
|
bool is_oneshot_ignored_key(uint16_t keycode);
|
|
@ -0,0 +1,21 @@
|
||||||
|
# My 34 keys layout
|
||||||
|
|
||||||
|
This are my principles for layout:
|
||||||
|
|
||||||
|
* I am using Callum style layout. Here you can read explanation by
|
||||||
|
Callum himself and his reasoning for not using mod-tap:
|
||||||
|
[here](../../../../users/callum/readme.md)
|
||||||
|
|
||||||
|
* There should be only one way to type key. Key can be on
|
||||||
|
different layer but it must maintain its physical location.
|
||||||
|
|
||||||
|
* The less features are used the better.
|
||||||
|
|
||||||
|
* trilayer is cool.
|
||||||
|
|
||||||
|
* There is 🐍 key for no reason.
|
||||||
|
|
||||||
|
As well I have added one shot layers compatible with Callum's one
|
||||||
|
shot keys.
|
||||||
|
|
||||||
|
There is simple TMUX layer as well.
|
|
@ -0,0 +1,5 @@
|
||||||
|
UNICODE_ENABLE = no
|
||||||
|
UNICODEMAP_ENABLE = yes
|
||||||
|
#CONSOLE_ENABLE = yes
|
||||||
|
|
||||||
|
SRC += oneshot.c
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
This is the c configuration file for the keymap
|
||||||
|
|
||||||
|
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||||
|
Copyright 2015 Jack Humbert
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Use I2C or Serial, not both */
|
||||||
|
#define USE_SERIAL
|
||||||
|
// #define USE_I2C
|
||||||
|
|
||||||
|
/* Select hand configuration */
|
||||||
|
#define MASTER_LEFT
|
||||||
|
// #define _MASTER_RIGHT
|
||||||
|
// #define EE_HANDS
|
||||||
|
|
||||||
|
#undef RGB_DI_PIN
|
||||||
|
#define RGB_DI_PIN D3
|
||||||
|
#undef RGBLED_NUM
|
||||||
|
#define RGBLIGHT_EFFECT_BREATHING
|
||||||
|
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||||
|
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||||
|
#define RGBLIGHT_EFFECT_SNAKE
|
||||||
|
#define RGBLIGHT_EFFECT_KNIGHT
|
||||||
|
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||||
|
#define RGBLED_NUM 10
|
||||||
|
|
||||||
|
#define RGBLIGHT_LAYERS
|
||||||
|
#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
|
||||||
|
#define RGBLIGHT_SLEEP
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
#define STARTUP_SONG SONG(PLANCK_SOUND)
|
||||||
|
// #define STARTUP_SONG SONG(NO_SOUND)
|
||||||
|
|
||||||
|
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
|
||||||
|
SONG(COLEMAK_SOUND), \
|
||||||
|
SONG(DVORAK_SOUND) \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define COMBO_COUNT 1
|
||||||
|
|
||||||
|
#define IGNORE_MOD_TAP_INTERRUPT
|
||||||
|
#define TAPPING_TERM 220
|
|
@ -0,0 +1,188 @@
|
||||||
|
/* Copyright 2021 Shay Merrill
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
enum lets_split_layers {
|
||||||
|
_DVORAK,
|
||||||
|
_QWERTY,
|
||||||
|
_LOWER,
|
||||||
|
_RAISE,
|
||||||
|
_ADJUST
|
||||||
|
};
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
DVORAK = SAFE_RANGE,
|
||||||
|
QWERTY
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TO_DV TO(_DVORAK)
|
||||||
|
#define LOWER MO(_LOWER)
|
||||||
|
#define LWR LOWER
|
||||||
|
#define RAISE MO(_RAISE)
|
||||||
|
#define RAS RAISE
|
||||||
|
|
||||||
|
enum combos //match combo_count in config.h
|
||||||
|
{
|
||||||
|
EU_ENT,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM eu_combo[] = {KC_E, KC_U, COMBO_END};
|
||||||
|
|
||||||
|
combo_t key_combos[COMBO_COUNT] = {
|
||||||
|
[EU_ENT] = COMBO_ACTION(eu_combo),
|
||||||
|
};
|
||||||
|
|
||||||
|
void process_combo_event(uint16_t combo_index, bool pressed) {
|
||||||
|
switch(combo_index) {
|
||||||
|
case EU_ENT:
|
||||||
|
if (pressed) {
|
||||||
|
tap_code16(KC_ENT);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_DVORAK] = LAYOUT(
|
||||||
|
KC_ESC, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH,
|
||||||
|
KC_TAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS,
|
||||||
|
KC_EQL, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_BSLS,
|
||||||
|
XXXXXXX, KC_ENT, KC_LALT, TT(LWR), KC_LSFT, KC_LCTL, KC_BSPC, KC_SPC, TT(RAS), KC_DEL, KC_LGUI, XXXXXXX
|
||||||
|
),
|
||||||
|
|
||||||
|
[_QWERTY] = LAYOUT(
|
||||||
|
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_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LGUI,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
|
||||||
|
[_LOWER] = LAYOUT(
|
||||||
|
_______, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_AMPR, _______, KC_P7, KC_P8, KC_P9, KC_PMNS, _______,
|
||||||
|
_______, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_ASTR, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______,
|
||||||
|
_______, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_GRV, _______, KC_P1, KC_P2, KC_P3, KC_PENT, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, KC_KP_0, _______, _______, _______, _______ //This kp_0 is blocking the space key.... may want to do something about that.
|
||||||
|
),
|
||||||
|
|
||||||
|
[_RAISE] = LAYOUT(
|
||||||
|
_______, KC_PSCR, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_VOLU, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX,
|
||||||
|
KC_CAPS, KC_INS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_VOLD, KC_F4, KC_F5, KC_F6, KC_F11, XXXXXXX,
|
||||||
|
_______, KC_NLCK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MUTE, KC_F1, KC_F2, KC_F3, KC_F12, XXXXXXX,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
|
||||||
|
[_ADJUST] = LAYOUT(
|
||||||
|
TO_DV, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL,
|
||||||
|
RGB_TOG, RGB_MOD, VLK_TOG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, DVORAK, _______, _______, _______,
|
||||||
|
RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const key_override_t delete_key_override = ko_make_basic(MOD_MASK_SHIFT, KC_BSPACE, KC_DELETE);
|
||||||
|
|
||||||
|
// This globally defines all key overrides to be used
|
||||||
|
const key_override_t **key_overrides = (const key_override_t *[]){
|
||||||
|
&delete_key_override,
|
||||||
|
NULL // Null terminate the array of overrides!
|
||||||
|
};
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case QWERTY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_QWERTY);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case DVORAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
||||||
|
const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||||
|
{4, 2, HSV_RED} // Light 2 LEDs, starting with LED 4
|
||||||
|
);
|
||||||
|
|
||||||
|
const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||||
|
{0, 3, HSV_CHARTREUSE} // Light 3 LEDs, starting with LED 0
|
||||||
|
);
|
||||||
|
|
||||||
|
const rgblight_segment_t PROGMEM my_lower_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||||
|
{3, 2, HSV_BLUE} // Light LEDs 3-4
|
||||||
|
);
|
||||||
|
|
||||||
|
const rgblight_segment_t PROGMEM my_raise_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||||
|
{5, 2, HSV_ORANGE} // Light LEDs 5-6
|
||||||
|
);
|
||||||
|
|
||||||
|
const rgblight_segment_t PROGMEM my_adjust_layer[] = RGBLIGHT_LAYER_SEGMENTS(
|
||||||
|
{3, 4, HSV_GREEN} // Light 4 LEDs, starting with LED 3
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//Later layers take precedence. This array corresponds to the magic numbers used in rgblight_set_layer_state(i, onOff)
|
||||||
|
const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
|
||||||
|
my_capslock_layer,
|
||||||
|
my_qwerty_layer, // Overrides other layers
|
||||||
|
my_lower_layer, // Overrides other layers
|
||||||
|
my_raise_layer, // Overrides other layers
|
||||||
|
my_adjust_layer // Overrides other layers
|
||||||
|
);
|
||||||
|
|
||||||
|
void keyboard_post_init_user(void) {
|
||||||
|
// Enable the LED layers
|
||||||
|
rgblight_layers = my_rgb_layers;
|
||||||
|
rgblight_disable_noeeprom(); // disables RGB, without saving settings
|
||||||
|
//rgblight_sethsv_noeeprom(HSV_CYAN);
|
||||||
|
//rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||||
|
// rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_SWIRL);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool led_update_user(led_t led_state) {
|
||||||
|
rgblight_set_layer_state(0, led_state.caps_lock);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||||
|
rgblight_set_layer_state(1, layer_state_cmp(state, _QWERTY));
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
|
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
rgblight_set_layer_state(2, layer_state_cmp(state, _LOWER));
|
||||||
|
rgblight_set_layer_state(3, layer_state_cmp(state, _RAISE));
|
||||||
|
rgblight_set_layer_state(4, layer_state_cmp(state, _ADJUST));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
RGBLIGHT_ENABLE = yes
|
||||||
|
VELOCIKEY_ENABLE = yes
|
||||||
|
KEY_OVERRIDE_ENABLE = yes
|
||||||
|
COMBO_ENABLE = yes
|
||||||
|
LTO_ENABLE = yes
|
Loading…
Reference in New Issue