Update personal userspace and keymaps + improve custom functionality (#5289)
* Change how desktop commands work * Add DST_MOD_MASK as a config option * DST_RMV → DST_REM * Add melody96:konstantin keymap * Update custom SEND_STRING * Move feature flags from userspace into keyboard rules * Use "Vo-", "Vo+" instead of "VoD", "VoU" in keymap comments * Add RGB controls and numpad Unicode to Melody96 keymap * Add RGB_SET keycode to Melody96 and RGB files to userspace * Generate UNICODE and UNICODEMAP constants using macros * Avoid collisions with X_* send string constants * Use two spaces before inline comments * Add _keymap versions of other custom Quantum functions Not added: eeconfig_update_keymap, eeconfig_read_keymap * Switch to UNICODEMAP in keyboard rules * Make toggle_numpad a nested function in process_record_user * Set Melody96 underglow color to Godspeed blue on EEPROM reset * Remove most _keymap and _user definitions in userspace Some keyboards misuse _user functions by defining them in the base files instead of the corresponding _kb functions (especially led_set_user and matrix_init_user). Until this is fixed (#5148), I've removed definitions in my userspace that could cause linking collisions. * Update GODSPEED_BLUE values and RGB mode keys * Add GODSPEED_YELLOW color * Set preferred intervals for rgblight effects * Update tap dance function names * Replace td_lshift_fn with generic td_mod_layer, add TD_RCTL_FN Move TD_FN_RCTL after TD_RCTL_FN * Replace td_fn_rctrl with generic td_layer_mod * Add blank lines, prefer explicit initialization * ACTION_TAP_DANCE_DOUBLE_MODS → ACTION_TAP_DANCE_DOUBLE_MOD * Update Godspeed colors * Add media controls to Melody96 keymap * Add SysRq, Break combos and other keys to Melody96 keymappull/5368/head
commit
edef1f9396
@ -1,2 +1,11 @@
|
||||
BOOTMAGIC_ENABLE = no
|
||||
COMMAND_ENABLE = yes
|
||||
CONSOLE_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
UNICODEMAP_ENABLE = yes
|
||||
|
||||
BACKLIGHT_ENABLE = no
|
||||
RGBLIGHT_ENABLE = no
|
||||
|
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define LAYER_FN
|
@ -0,0 +1,10 @@
|
||||
BOOTMAGIC_ENABLE = no
|
||||
COMMAND_ENABLE = yes
|
||||
CONSOLE_ENABLE = no
|
||||
EXTRAKEY_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
UNICODEMAP_ENABLE = yes
|
||||
|
||||
BACKLIGHT_ENABLE = no
|
@ -1,2 +1,11 @@
|
||||
BOOTMAGIC_ENABLE = no
|
||||
COMMAND_ENABLE = yes
|
||||
CONSOLE_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
UNICODEMAP_ENABLE = yes
|
||||
|
||||
BACKLIGHT_ENABLE = no
|
||||
VISUALIZER_ENABLE = no
|
||||
|
@ -0,0 +1,24 @@
|
||||
#include "rgb.h"
|
||||
|
||||
#ifdef RGBLIGHT_EFFECT_BREATHING
|
||||
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {20, 30, 5, 10};
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {20, 50, 100};
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {20, 50, 100};
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_EFFECT_SNAKE
|
||||
const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {20, 50, 100};
|
||||
#endif
|
||||
|
||||
#ifdef RGBLIGHT_EFFECT_KNIGHT
|
||||
const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {20, 50, 100};
|
||||
#endif
|
||||
|
||||
const hsv_t GODSPEED_BLUE = { .h = 280, .s = 68, .v = RGBLIGHT_LIMIT_VAL };
|
||||
const hsv_t GODSPEED_YELLOW = { .h = 38, .s = 153, .v = RGBLIGHT_LIMIT_VAL };
|
@ -1,15 +1,12 @@
|
||||
BOOTMAGIC_ENABLE = no
|
||||
COMMAND_ENABLE = yes
|
||||
CONSOLE_ENABLE = yes
|
||||
EXTRAKEY_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
UNICODE_ENABLE = yes
|
||||
|
||||
SRC += konstantin.c
|
||||
ifneq (,$(filter yes,$(RGBLIGHT_ENABLE) $(RGB_MATRIX_ENABLE))) # if either is yes
|
||||
SRC += rgb.c
|
||||
endif
|
||||
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
|
||||
SRC += tap_dance.c
|
||||
endif
|
||||
ifneq (,$(filter yes,$(UNICODE_ENABLE) $(UNICODEMAP_ENABLE))) # if either is yes
|
||||
SRC += unicode.c
|
||||
endif
|
||||
|
||||
EXTRAFLAGS += -flto
|
||||
|
@ -1,93 +1,117 @@
|
||||
#include "tap_dance.h"
|
||||
#include "konstantin.h"
|
||||
|
||||
#define ACTION_TAP_DANCE_DOUBLE_MODS(mod1, mod2) { \
|
||||
.fn = { td_double_mods_each, NULL, td_double_mods_reset }, \
|
||||
.user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \
|
||||
#define ACTION_TAP_DANCE_DOUBLE_MOD(mod1, mod2) { \
|
||||
.fn = { td_double_mod_each, NULL, td_double_mod_reset }, \
|
||||
.user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \
|
||||
}
|
||||
|
||||
void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data;
|
||||
void td_double_mod_each(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data;
|
||||
|
||||
// Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2
|
||||
if (state->count == 1 || state->count == 3) {
|
||||
register_code(mods->kc1);
|
||||
register_code(data->kc1);
|
||||
} else if (state->count == 2) {
|
||||
unregister_code(mods->kc1);
|
||||
register_code(mods->kc2);
|
||||
unregister_code(data->kc1);
|
||||
register_code(data->kc2);
|
||||
}
|
||||
// Prevent tap dance from sending kc1 and kc2 as weak mods
|
||||
state->weak_mods &= ~(MOD_BIT(mods->kc1) | MOD_BIT(mods->kc2));
|
||||
// Prevent tap dance from sending the mods as weak mods
|
||||
state->weak_mods &= ~(MOD_BIT(data->kc1) | MOD_BIT(data->kc2));
|
||||
}
|
||||
|
||||
void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data;
|
||||
void td_double_mod_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_pair_t *data = (qk_tap_dance_pair_t *)user_data;
|
||||
|
||||
if (state->count == 1 || state->count >= 3) {
|
||||
unregister_code(mods->kc1);
|
||||
unregister_code(data->kc1);
|
||||
}
|
||||
if (state->count >= 2) {
|
||||
unregister_code(mods->kc2);
|
||||
unregister_code(data->kc2);
|
||||
}
|
||||
}
|
||||
|
||||
struct {
|
||||
bool fn_on; // Layer state when tap dance started
|
||||
bool started;
|
||||
} td_fn_rctrl_data;
|
||||
|
||||
void td_fn_rctrl_each(qk_tap_dance_state_t *state, void *user_data) {
|
||||
if (!td_fn_rctrl_data.started) {
|
||||
td_fn_rctrl_data.fn_on = IS_LAYER_ON(L_FN);
|
||||
td_fn_rctrl_data.started = true;
|
||||
#define ACTION_TAP_DANCE_MOD_LAYER(mod, layer) { \
|
||||
.fn = { td_mod_layer_each, NULL, td_mod_layer_reset }, \
|
||||
.user_data = &(qk_tap_dance_dual_role_t){ mod, layer }, \
|
||||
}
|
||||
// Single tap → Fn, double tap → RCtrl, triple tap etc. → Fn+RCtrl
|
||||
|
||||
void td_mod_layer_each(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data;
|
||||
|
||||
// Single tap → mod, double tap → layer, triple tap etc. → mod+layer
|
||||
if (state->count == 1 || state->count == 3) {
|
||||
layer_on(L_FN);
|
||||
register_code(data->kc);
|
||||
} else if (state->count == 2) {
|
||||
if (!td_fn_rctrl_data.fn_on) {
|
||||
layer_off(L_FN);
|
||||
}
|
||||
register_code(KC_RCTL);
|
||||
unregister_code(data->kc);
|
||||
// Prevent tap dance from sending the mod as a weak mod
|
||||
state->weak_mods &= ~MOD_BIT(data->kc);
|
||||
layer_on(data->layer);
|
||||
}
|
||||
}
|
||||
|
||||
void td_fn_rctrl_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
if ((state->count == 1 || state->count >= 3) && !td_fn_rctrl_data.fn_on) {
|
||||
layer_off(L_FN);
|
||||
void td_mod_layer_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data;
|
||||
|
||||
if (state->count == 1 || state->count >= 3) {
|
||||
unregister_code(data->kc);
|
||||
}
|
||||
if (state->count >= 2) {
|
||||
unregister_code(KC_RCTL);
|
||||
layer_off(data->layer);
|
||||
}
|
||||
td_fn_rctrl_data.started = false;
|
||||
}
|
||||
|
||||
void td_lsft_fn_each(qk_tap_dance_state_t *state, void *user_data) {
|
||||
// Single tap → LShift, double tap → Fn, triple tap etc. → Fn+LShift
|
||||
#define ACTION_TAP_DANCE_LAYER_MOD(layer, mod) { \
|
||||
.fn = { td_layer_mod_each, NULL, td_layer_mod_reset }, \
|
||||
.user_data = &(qk_tap_dance_layer_mod_t){ layer, mod, 0, 0 }, \
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint8_t layer;
|
||||
uint16_t kc;
|
||||
bool layer_on; // Layer state when tap dance started
|
||||
bool started;
|
||||
} qk_tap_dance_layer_mod_t;
|
||||
|
||||
void td_layer_mod_each(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data;
|
||||
if (!data->started) {
|
||||
data->layer_on = IS_LAYER_ON(data->layer);
|
||||
data->started = true;
|
||||
}
|
||||
|
||||
// Single tap → layer, double tap → mod, triple tap etc. → layer+mod
|
||||
if (state->count == 1 || state->count == 3) {
|
||||
register_code(KC_LSFT);
|
||||
layer_on(data->layer);
|
||||
} else if (state->count == 2) {
|
||||
unregister_code(KC_LSFT);
|
||||
// Prevent tap dance from sending LShift as a weak mod
|
||||
state->weak_mods &= ~MOD_BIT(KC_LSFT);
|
||||
layer_on(L_FN);
|
||||
if (!data->layer_on) {
|
||||
layer_off(data->layer);
|
||||
}
|
||||
register_code(data->kc);
|
||||
}
|
||||
}
|
||||
|
||||
void td_lsft_fn_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
if (state->count == 1 || state->count >= 3) {
|
||||
unregister_code(KC_LSFT);
|
||||
void td_layer_mod_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_layer_mod_t *data = (qk_tap_dance_layer_mod_t *)user_data;
|
||||
|
||||
if ((state->count == 1 || state->count >= 3) && !data->layer_on) {
|
||||
layer_off(data->layer);
|
||||
}
|
||||
if (state->count >= 2) {
|
||||
layer_off(L_FN);
|
||||
unregister_code(data->kc);
|
||||
}
|
||||
|
||||
data->started = false;
|
||||
}
|
||||
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_DESKTOP] = ACTION_TAP_DANCE_DOUBLE(LCTL(LGUI(KC_D)), LCTL(LGUI(KC_F4))), // Add/close virtual desktop
|
||||
[TD_DST_A_R] = ACTION_TAP_DANCE_DOUBLE(DST_ADD, DST_REM),
|
||||
|
||||
[TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_LALT),
|
||||
[TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RALT, KC_RGUI),
|
||||
[TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RCTL, KC_RSFT),
|
||||
[TD_RAL_LAL] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_LALT),
|
||||
[TD_RAL_RGU] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RALT, KC_RGUI),
|
||||
[TD_RCT_RSF] = ACTION_TAP_DANCE_DOUBLE_MOD(KC_RCTL, KC_RSFT),
|
||||
|
||||
[TD_FN_RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(td_fn_rctrl_each, NULL, td_fn_rctrl_reset),
|
||||
[TD_LSFT_FN] = ACTION_TAP_DANCE_FN_ADVANCED(td_lsft_fn_each, NULL, td_lsft_fn_reset),
|
||||
[TD_LSFT_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_LSFT, L_FN),
|
||||
[TD_RCTL_FN] = ACTION_TAP_DANCE_MOD_LAYER(KC_RCTL, L_FN),
|
||||
[TD_FN_RCTL] = ACTION_TAP_DANCE_LAYER_MOD(L_FN, KC_RCTL),
|
||||
};
|
||||
|
@ -0,0 +1,7 @@
|
||||
#include "unicode.h"
|
||||
|
||||
#ifdef UNICODEMAP_ENABLE
|
||||
const uint32_t PROGMEM unicode_map[] = {
|
||||
FOREACH_UNICODE(UCM_ENTRY)
|
||||
};
|
||||
#endif
|
Loading…
Reference in new issue