From 03e53dc8a2958c44b03b3863c27ce29b94f81f08 Mon Sep 17 00:00:00 2001 From: Jarrett Drouillard Date: Thu, 23 May 2019 00:40:16 -0400 Subject: [Keymap] changes to my userspace and preonic keymap ( spring 2019 ) (#5881) * feat-user-kuatsure: abstract symbol row out * feat-user-kuatsure: abstract grouped bracket, brace, paren out * fix-preonic-kuatsure: remove eol as requested by @drashna * feat-user-kuatsure: add KC_MAKE and KC_FLSH thanks to @drashna for the help * chore-preonic-kuatsure: remove auto shift * chore-user-kuatsure: move leader seq's to macro syntax * feat-user-kuatsure: add `KC_VRSN` key plus use it preonic keymap * chore-user-kuatsure: namespace keyboard macros `KB` * chore-preonic-kuatsure: move some keyboardy keys around * chore-preonic-kuatsure: remove parens, brackets, braces from lower * chore-user-kuatsure: move tmux window shifts to dbl press leaders * feat-user-kuatsure: add a computer lock leader seq * fix-preonic-kuatsure: go back to lower brackets * chore-preonic-kuatsure: clear out raise * feat-various-kuatsure: add meh + tab mod tap * chore-preonic-kuatsure: `raise` eats `game_mod` layer * fix-preonic-kuatsure: reverse pg up and pg down * chore-user-kuatsure: add double tap to turn off music * chore-user-kuatsure: move like seqs together * chore-preonic-kuatsure: add a few more items to the num pad on raise * feat-user-kuatsure: re-enable td for <> keys * chore-user-kuatsure: give a little more grace period for leader * fix-user-kuatsure: give lock leader a gui buffer no timer or anything, but alfred doesn't boot up as quickly as I would like sometimes gui doesn't do anything but gives a little bit of a time bump * fix-user-kuatsure: changes from @drashna review --- users/kuatsure/kuatsure.c | 140 +++++++++++++++++++++++++++------------------- 1 file changed, 84 insertions(+), 56 deletions(-) (limited to 'users/kuatsure/kuatsure.c') diff --git a/users/kuatsure/kuatsure.c b/users/kuatsure/kuatsure.c index a18713626e..f935e83c74 100644 --- a/users/kuatsure/kuatsure.c +++ b/users/kuatsure/kuatsure.c @@ -1,35 +1,62 @@ #include "kuatsure.h" +#include "version.h" -void tmux_prefix(void) { - register_code(KC_LCTL); - register_code(KC_SPC); +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_LBRC] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, KC_LT), + [TD_RBRC] = ACTION_TAP_DANCE_DOUBLE(KC_RBRC, KC_GT) +}; - unregister_code(KC_LCTL); - unregister_code(KC_SPC); +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; } -void tmux_pane_zoom(void) { - tmux_prefix(); +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KB_MAKE: + if (!record->event.pressed) { + SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP SS_TAP(X_ENTER)); + } + return false; + break; + + case KB_VRSN: + if (!record->event.pressed) { + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; + + case KB_FLSH: + if (!record->event.pressed) { + SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP + #if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) + ":dfu " + #elif defined(BOOTLOADER_HALFKAY) + ":teensy " + #elif defined(BOOTLOADER_CATERINA) + ":avrdude " + #endif + SS_TAP(X_ENTER) + ); + + reset_keyboard(); + } + return false; + break; + } - register_code(KC_Z); - unregister_code(KC_Z); + return process_record_keymap(keycode, record); } -void tmux_pane_switch(uint16_t keycode) { - tmux_prefix(); - - register_code(KC_Q); - unregister_code(KC_Q); - - register_code(keycode); - unregister_code(keycode); +void tmux_prefix(void) { + tap_code16(LCTL(KC_SPC)); } -void tmux_window_switch(uint16_t keycode) { +void tmux_pane_zoom(void) { tmux_prefix(); - register_code(keycode); - unregister_code(keycode); + SEND_STRING("z"); } LEADER_EXTERNS(); @@ -43,69 +70,70 @@ void matrix_scan_user(void) { // anything you can do in a macro https://docs.qmk.fm/macros.html // https://docs.qmk.fm/feature_leader_key.html + // Stop music and lock computer via alfred + SEQ_ONE_KEY(KC_H) { + SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER)); + } + + // Stop music and lock computer via alfred + SEQ_TWO_KEYS(KC_H, KC_H) { + SEND_STRING(SS_LGUI(" ") SS_TAP(X_LGUI) "afk" SS_TAP(X_ENTER) SS_TAP(X_MEDIA_PLAY_PAUSE)); + } + // Whole Screen Shot SEQ_ONE_KEY(KC_A) { - register_code(KC_LGUI); - register_code(KC_LSFT); - register_code(KC_3); - - unregister_code(KC_3); - unregister_code(KC_LSFT); - unregister_code(KC_LGUI); + SEND_STRING(SS_LGUI(SS_LSFT("3"))); } // Selective Screen Shot SEQ_ONE_KEY(KC_S) { - register_code(KC_LGUI); - register_code(KC_LSFT); - register_code(KC_4); - - unregister_code(KC_4); - unregister_code(KC_LSFT); - unregister_code(KC_LGUI); + SEND_STRING(SS_LGUI(SS_LSFT("4"))); } // TMUX - shift to pane 1 and zoom SEQ_ONE_KEY(KC_J) { - tmux_pane_switch(KC_1); + tmux_prefix(); + SEND_STRING("q1"); tmux_pane_zoom(); } + // TMUX - shift to first window + SEQ_TWO_KEYS(KC_J, KC_J) { + tmux_prefix(); + SEND_STRING("1"); + } + // TMUX - shift to pane 2 and zoom SEQ_ONE_KEY(KC_K) { - tmux_pane_switch(KC_2); + tmux_prefix(); + SEND_STRING("q2"); tmux_pane_zoom(); } + // TMUX - shift to second window + SEQ_TWO_KEYS(KC_K, KC_K) { + tmux_prefix(); + SEND_STRING("2"); + } + // TMUX - shift to pane 3 and zoom SEQ_ONE_KEY(KC_L) { - tmux_pane_switch(KC_3); + tmux_prefix(); + SEND_STRING("q3"); tmux_pane_zoom(); } + // TMUX - shift to third window + SEQ_TWO_KEYS(KC_L, KC_L) { + tmux_prefix(); + SEND_STRING("3"); + } + // TMUX - shift to last pane and zoom SEQ_ONE_KEY(KC_SCOLON) { tmux_prefix(); - - register_code(KC_SCOLON); - unregister_code(KC_SCOLON); - + SEND_STRING(";"); tmux_pane_zoom(); } - - // TMUX - shift to first window - SEQ_ONE_KEY(KC_U) { - tmux_window_switch(KC_1); - } - - // TMUX - shift to second window - SEQ_ONE_KEY(KC_I) { - tmux_window_switch(KC_2); - } - - // TMUX - shift to third window - SEQ_ONE_KEY(KC_O) { - tmux_window_switch(KC_3); - } } } -- cgit v1.2.3