Update keychron keymap
This commit is contained in:
parent
0b7c87fd5b
commit
cc33b5ce17
7 changed files with 38 additions and 145 deletions
16
Makefile
16
Makefile
|
@ -1,16 +0,0 @@
|
|||
.SILENT:
|
||||
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
QMK_USERSPACE := $(patsubst %/,%,$(dir $(shell realpath "$(lastword $(MAKEFILE_LIST))")))
|
||||
ifeq ($(QMK_USERSPACE),)
|
||||
QMK_USERSPACE := $(shell pwd)
|
||||
endif
|
||||
|
||||
QMK_FIRMWARE_ROOT = $(shell qmk config -ro user.qmk_home | cut -d= -f2 | sed -e 's@^None$$@@g')
|
||||
ifeq ($(QMK_FIRMWARE_ROOT),)
|
||||
$(error Cannot determine qmk_firmware location. `qmk config -ro user.qmk_home` is not set)
|
||||
endif
|
||||
|
||||
%:
|
||||
+$(MAKE) -C $(QMK_FIRMWARE_ROOT) $(MAKECMDGOALS) QMK_USERSPACE=$(QMK_USERSPACE)
|
11
README.md
11
README.md
|
@ -1,3 +1,14 @@
|
|||
# QMK Userspace
|
||||
|
||||
All my qmk keymaps.
|
||||
|
||||
## Instructions
|
||||
|
||||
1. Setup qmk. (Run `qmk setup`)
|
||||
|
||||
2. Clone this repo to the value of qmk `user.overlay_dir` config variable.
|
||||
|
||||
3. The keymaps in this repo will be available for use with `qmk config` and `qmk flash`.
|
||||
|
||||
Example command: ```qmk flash -kb keychron/q1v2/ansi_encoder -km hadeed```
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#define TAPPING_TERM 150
|
||||
#define QUICK_TAP_TERM 150
|
||||
|
||||
#undef HOLD_ON_OTHER_KEY_PRESS
|
||||
#define PERMISSIVE_HOLD
|
|
@ -1,23 +0,0 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "layers.h"
|
||||
|
||||
static void encoder_brightness(bool clockwise) {
|
||||
if (clockwise)
|
||||
rgb_matrix_increase_val_noeeprom();
|
||||
else
|
||||
rgb_matrix_decrease_val_noeeprom();
|
||||
}
|
||||
|
||||
static void encoder_volume(bool clockwise) {
|
||||
tap_code_delay(clockwise ? KC_VOLU : KC_VOLD, 10);
|
||||
}
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (IS_LAYER_ON(FN))
|
||||
encoder_brightness(clockwise);
|
||||
else
|
||||
encoder_volume(clockwise);
|
||||
|
||||
return false;
|
||||
}
|
|
@ -1,103 +1,46 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "layers.h"
|
||||
|
||||
void set_backlight(void);
|
||||
void change_default_layer(bool);
|
||||
|
||||
enum custom_keycodes {
|
||||
CK_LRUP = SAFE_RANGE,
|
||||
CK_LRDN
|
||||
enum layers{
|
||||
BASE,
|
||||
FN,
|
||||
NAV,
|
||||
};
|
||||
|
||||
#define KC_TASK G(KC_TAB)
|
||||
#define KC_FLXP G(KC_E)
|
||||
|
||||
#define HRM_A LALT_T(KC_A)
|
||||
#define HRM_S LGUI_T(KC_S)
|
||||
#define HRM_D LCTL_T(KC_D)
|
||||
#define HRM_F LSFT_T(KC_F)
|
||||
|
||||
#define HRM_J RSFT_T(KC_J)
|
||||
#define HRM_K RCTL_T(KC_K)
|
||||
#define HRM_L RGUI_T(KC_L)
|
||||
#define HRM_SLN RALT_T(KC_SCLN)
|
||||
#define KC_TASK LGUI(KC_TAB)
|
||||
#define KC_FLXP LGUI(KC_E)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[LINUX] = LAYOUT_ansi_82(
|
||||
_______, 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_DEL, KC_MUTE,
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
|
||||
KC_ESC, HRM_A, HRM_S, HRM_D, HRM_F, KC_G, KC_H, HRM_J, HRM_K, HRM_L, HRM_SLN, KC_QUOT, KC_ENT, KC_HOME,
|
||||
_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, KC_UP,
|
||||
MO(NAV), _______, _______, KC_SPC, _______, MO(FN), _______, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[NAV] = LAYOUT_ansi_82(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
|
||||
|
||||
/* ----------------------------------------------------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
[DOTA] = LAYOUT_ansi_82(
|
||||
[BASE] = LAYOUT_ansi_82(
|
||||
KC_ESC, 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_DEL, KC_MUTE,
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_PGUP,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
|
||||
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_HOME,
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------------------------------------------------------------------------------------------- */
|
||||
MO(NAV), KC_LCMD, KC_LALT, KC_SPC, KC_RALT, MO(FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
[FN] = LAYOUT_ansi_82(
|
||||
QK_RBT, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CK_LRUP,
|
||||
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CK_LRDN,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______,
|
||||
_______, KC_BRID, KC_BRIU, _______, _______, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, QK_BOOT, _______,
|
||||
_______, _______, _______, _______, _______, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
|
||||
|
||||
[NAV] = LAYOUT_ansi_82(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case CK_LRUP:
|
||||
case CK_LRDN:
|
||||
if (record->event.pressed)
|
||||
change_default_layer(keycode == CK_LRUP);
|
||||
return false;
|
||||
}
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
|
||||
return true;
|
||||
}
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[BASE] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
|
||||
[FN] = { ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
|
||||
[NAV] = { ENCODER_CCW_CW(_______, _______)}
|
||||
};
|
||||
|
||||
// The boring stuff
|
||||
|
||||
void set_backlight(void) {
|
||||
uint8_t v = rgb_matrix_get_val();
|
||||
|
||||
if (IS_LAYER_ON_STATE(default_layer_state, LINUX))
|
||||
rgb_matrix_sethsv_noeeprom(HSV_WHITE);
|
||||
else if (IS_LAYER_ON_STATE(default_layer_state, DOTA))
|
||||
rgb_matrix_sethsv_noeeprom(HSV_RED);
|
||||
|
||||
rgb_matrix_sethsv_noeeprom(rgb_matrix_get_hue(), rgb_matrix_get_sat(), v);
|
||||
}
|
||||
|
||||
void change_default_layer(bool layer_up) {
|
||||
layer_state_t x = (layer_up ? default_layer_state<<1 : default_layer_state>>1) & ((1 << BASE_LAYERS) - 1);
|
||||
default_layer_set(x != 0 ? x : (layer_up ? 1U : (1 << (BASE_LAYERS-1))));
|
||||
|
||||
set_backlight();
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
|
||||
rgb_matrix_sethsv_noeeprom(rgb_matrix_get_hue(), rgb_matrix_get_sat(), 128);
|
||||
|
||||
set_backlight();
|
||||
}
|
||||
#endif // ENCODER_MAP_ENABLE
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef LAYERS_H
|
||||
#define LAYERS_H
|
||||
|
||||
enum base_layers {
|
||||
LINUX,
|
||||
DOTA,
|
||||
BASE_LAYERS
|
||||
};
|
||||
|
||||
enum other_layers {
|
||||
NAV = BASE_LAYERS,
|
||||
FN,
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +1 @@
|
|||
SRC += encoder.c
|
||||
|
||||
ENCODER_MAP_ENABLE = no
|
||||
ENCODER_MAP_ENABLE = yes
|
Loading…
Reference in a new issue