summaryrefslogtreecommitdiff
path: root/users/kuatsure/kuatsure.c
blob: bfdbdd403531d48a62f716e870fc7e33e42506ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include "kuatsure.h"
#include "version.h"

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),
  [TD_SLSH] = ACTION_TAP_DANCE_DOUBLE(KC_SLSH, KC_BSLS),
};

__attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  return true;
}

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(
          "qmk flash -kb " QMK_KEYBOARD " -km " QMK_KEYMAP
        );

        reset_keyboard();
      }
      return false;
      break;
  }

  return process_record_keymap(keycode, record);
}

void tmux_prefix(void) {
  tap_code16(LCTL(KC_SPC));
}

void tmux_pane_zoom(void) {
  tmux_prefix();

  SEND_STRING("z");
}

LEADER_EXTERNS();
void matrix_scan_user(void) {
  LEADER_DICTIONARY() {
    leading = false;
    leader_end();

    // Available seqs
    // SEQ_ONE_KEY, SEQ_TWO_KEYS, SEQ_THREE_KEYS
    // 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) {
      SEND_STRING(SS_LGUI(SS_LSFT("3")));
    }

    // Selective Screen Shot
    SEQ_ONE_KEY(KC_S) {
      SEND_STRING(SS_LGUI(SS_LSFT("4")));
    }

    // TMUX - shift to pane 1 and zoom
    SEQ_ONE_KEY(KC_J) {
      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_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_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_SEMICOLON) {
      tmux_prefix();
      SEND_STRING(";");
      tmux_pane_zoom();
    }
  }
}