Skip to content

Commit

Permalink
Add mouse highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisTestov committed Jan 16, 2025
1 parent 3828703 commit 456e8a8
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
31 changes: 31 additions & 0 deletions keyboards/drop/alt/keymaps/fylch_alt/key_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
static bool enter_modifier_pressed = false;

switch (keycode) {
case MD_BOOT:
Expand All @@ -20,6 +21,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
return false;
case KC_UP:
if (record->event.pressed) {
register_code(KC_UP);
enter_modifier_pressed = true;
}
else {
unregister_code(KC_UP);
enter_modifier_pressed = false;
}
return false;
case KC_ENT:
if (record->event.pressed) {
if (enter_modifier_pressed) {
SEND_STRING(SS_LCTL(SS_TAP(X_ENTER)));
} else {
register_code(KC_ENT);
}
}
else {
unregister_code(KC_ENT);
}
return false;
case PYCHARM_COMMENT:
if (record->event.pressed) {
SEND_STRING(SS_LCTL(SS_TAP(X_SLASH)));
Expand Down Expand Up @@ -75,6 +98,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
SEND_STRING(SS_LCTL(SS_LALT(SS_TAP(X_T))));
}
return false;
case KC_F20:
if (record->event.pressed) {
uprintf("F20 pressed\n");
tap_code(KC_LCTL);
wait_ms(150);
tap_code(KC_LCTL);
}
return false;
default:
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion keyboards/drop/alt/keymaps/fylch_alt/layers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, _______,_______, _______, _______, _______, _______, KC_PGUP,
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_PGDN,
_______, _______, _______, _______, _______, MD_BOOT, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, _______, _______, KC_HOME, _______, KC_END
),
[2] = LAYOUT_65_ansi_blocker(
_______, TD(TD_BOOKMARK_1), TD(TD_BOOKMARK_2), TD(TD_BOOKMARK_3), TD(TD_BOOKMARK_4), TD(TD_BOOKMARK_5), TD(TD_BOOKMARK_6), TD(TD_BOOKMARK_7), TD(TD_BOOKMARK_8), TD(TD_BOOKMARK_9), TD(TD_BOOKMARK_REMOVE), _______, _______, TD(TD_STOP), _______,
Expand Down
8 changes: 8 additions & 0 deletions keyboards/drop/alt/keymaps/fylch_alt/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
TAP_DANCE_ENABLE = yes
CONSOLE_ENABLE = no


NO_SUSPEND_POWER_DOWN = yes

MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = no

EXTRAFLAGS += -flto -Os -ffunction-sections -fdata-sections -fno-exceptions -fno-unwind-tables
LDFLAGS += -Wl,--gc-sections
26 changes: 25 additions & 1 deletion keyboards/drop/alt/keymaps/fylch_alt/tapdance.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "alt_config.h"
#include "utils.h"

static bool shift_held = false;

enum {
TD_CTRL,
TD_EN,
Expand Down Expand Up @@ -210,11 +212,33 @@ void td_stop_finished(tap_dance_state_t *state, void *user_data) {
}
}

void shift_finished(tap_dance_state_t *state, void *user_data) {
shift_held = state->pressed;

if (state->count == 1 && state->pressed) {
register_code(KC_LSFT);
} else if (state->count == 2) {
tap_code(KC_LCTL);
wait_ms(150);
tap_code(KC_LCTL);
} else if (state->count == 1) {
tap_code(KC_LSFT);
}
}

void shift_reset(tap_dance_state_t *state, void *user_data) {
if (shift_held) {
unregister_code(KC_LSFT);
}
shift_held = false;
}


tap_dance_action_t tap_dance_actions[] = {
[TD_CTRL] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_ESC),
[TD_EN] = ACTION_TAP_DANCE_FN(td_en_finished),
[TD_RU] = ACTION_TAP_DANCE_FN(td_ru_finished),
[TD_SHIFT] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS_LOCK),
[TD_SHIFT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, shift_finished, shift_reset),
[TD_LAYER_MOD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, td_layer_mod_finished, td_layer_mod_reset),
[TD_BOOKMARK_1] = ACTION_TAP_DANCE_FN(td_bookmark_1_finished),
[TD_BOOKMARK_2] = ACTION_TAP_DANCE_FN(td_bookmark_2_finished),
Expand Down

0 comments on commit 456e8a8

Please sign in to comment.