summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/ninjonas/README.md25
-rw-r--r--users/ninjonas/combos.c55
-rw-r--r--users/ninjonas/config.h11
-rw-r--r--users/ninjonas/encoder.c104
-rw-r--r--users/ninjonas/ninjonas.h23
-rw-r--r--users/ninjonas/process_records.c14
-rw-r--r--users/ninjonas/process_records.h1
-rw-r--r--users/ninjonas/rules.mk5
-rw-r--r--users/ninjonas/tap_dances.c66
-rw-r--r--users/ninjonas/tap_dances.h14
10 files changed, 242 insertions, 76 deletions
diff --git a/users/ninjonas/README.md b/users/ninjonas/README.md
index f537373bcf..f6c2f32352 100644
--- a/users/ninjonas/README.md
+++ b/users/ninjonas/README.md
@@ -23,8 +23,6 @@ See: https://docs.qmk.fm/#/feature_userspace
|K_LOCK | MacOS shortcut to execute lock command Cmd + CTRL + Q |
|K_CSCN | MacOS shortcut to copy a portion of the screen to the clipboard |
|K_MDSH | MacOS shortcut to get em-dash `–` |
-|K_RAPP | MacOS shortcut to switch apps to the right |
-|K_LAPP | MacOS shortcut to switch apps to the left |
|K_CPRF | Cmd + Shift + M. Used for switching Google Chrome profiles |
### [Layers](ninjonas.h)
@@ -32,17 +30,12 @@ See: https://docs.qmk.fm/#/feature_userspace
|---|---|
|LT_LOW | Tap for ENTER, hold for RAISE |
|LT_RAI | Tap for SPACE, hold for LOWER |
-|LT_LOW + LT_RAI | Hold for ADJUST |
-|LM_LOW | Dedicated key to momentarily toggle to use LOWER layer |
-|LM_RAI | Dedicated key to momentarily toggle to use RAISE layer |
-|LG_LOW | Press to toggle LOWER layer |
-|LG_RAI | Press to toggle RAISE layer |
### [Mod-Taps](ninjonas.h)
|Code | Description |
|---|---|
-|MT_DEL | Tap for Delete, hold for Cmd + ALT + SHIFT |
-|MT_EQL | Tap for =, hold for ALT + SHIFT |
+|MT_DEL | Tap for Delete, hold for ALT + SHIFT |
+|MT_EQL | Tap for =, SHIFT |
### [Layout Blocks](ninjonas.h)
Predefined keyboard layout templates to speed up configuring split keyboards
@@ -72,7 +65,6 @@ Predefined keyboard layout templates to speed up configuring split keyboards
|M_SHFT | Sends Cmd + alt + shift to a keycode to activate [ShiftIt](https://github.com/fikovnik/ShiftIt) |
|M_CODE | Opens [Visual Studio Code](https://code.visualstudio.com/) on current directory |
|M_TERM | Launches Spotlight and calls Terminal |
-|M_COPA | Single key copy/paste |
|M_XXX1 to M_XXX5 | Reserved for secret macros see [Secrets](#secrets) |
### [Tap-Dance](tap_dances.h)
@@ -84,11 +76,18 @@ Predefined keyboard layout templates to speed up configuring split keyboards
|T_TAB | Tap once for TAB, double for CTRL + TAB |
|T_GRV | Tap once for GRV, double for Cmd + GRV |
|T_GUI | Tap once for Cmd, double to open spotlight |
-|T_W | Tap for W, double tap for Cmd + W |
-|T_Q | Tap for Q, double tap for Cmd + Q |
-|T_CPNU | Tap for Cmd + V, hold for Cmd + C, double tap for NUMPAD layer |
+|T_CPAP | Tap for Cmd + V, hold for Cmd + C, double tap to open [Line](https://line.me/en/) app, triple tap for itunes. |
|T_Y | Tap for Y, double tap for NUMPAD layer |
+### [Combos](combos.h)
+|Code | Description |
+|---|---|
+|EQ_QUIT | Press E + Q will trigger Cmd + Q |
+|RW_CLOSE | Press R + W will trigger Cmd + W|
+|ET_TAB | Press E + T will trigger Cmd + T|
+|ZC_COPY | Press Z + C will trigger Cmd + C|
+|XV_PASTE | Press X + V will trigger Cmd + V|
+
### Secrets
There's times where you have macros you don't want to share like emails, an address you need but you always forget, passwords 😱, & and private strings. Based off [drashna's secret macros](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/readme_secrets.md), it's now possible to do this. All you need to do is create a `secrets.c` file. Below is an example of how this is used.
diff --git a/users/ninjonas/combos.c b/users/ninjonas/combos.c
new file mode 100644
index 0000000000..9453ba84dc
--- /dev/null
+++ b/users/ninjonas/combos.c
@@ -0,0 +1,55 @@
+#include "ninjonas.h"
+
+#ifdef COMBO_ENABLE
+enum combo_events {
+ EQ_QUIT,
+ RW_CLOSE,
+ QT_TAB,
+ ZC_COPY,
+ XV_PASTE
+};
+
+const uint16_t PROGMEM quit_combo[] = {KC_E, KC_Q, COMBO_END};
+const uint16_t PROGMEM close_combo[] = {KC_R, KC_W, COMBO_END};
+const uint16_t PROGMEM tab_combo[] = {KC_Q, KC_T, COMBO_END};
+const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_C, COMBO_END};
+const uint16_t PROGMEM paste_combo[] = {KC_X, KC_V, COMBO_END};
+
+combo_t key_combos[COMBO_COUNT] = {
+ [EQ_QUIT] = COMBO_ACTION(quit_combo),
+ [RW_CLOSE] = COMBO_ACTION(close_combo),
+ [QT_TAB] = COMBO_ACTION(tab_combo),
+ [ZC_COPY] = COMBO_ACTION(copy_combo),
+ [XV_PASTE] = COMBO_ACTION(paste_combo),
+};
+
+void process_combo_event(uint8_t combo_index, bool pressed) {
+ switch(combo_index) {
+ case EQ_QUIT:
+ if (pressed) {
+ tap_code16(LGUI(KC_Q));
+ }
+ break;
+ case RW_CLOSE:
+ if (pressed) {
+ tap_code16(LGUI(KC_W));
+ }
+ break;
+ case QT_TAB:
+ if (pressed) {
+ tap_code16(LGUI(KC_T));
+ }
+ break;
+ case ZC_COPY:
+ if (pressed) {
+ tap_code16(LGUI(KC_C));
+ }
+ break;
+ case XV_PASTE:
+ if (pressed) {
+ tap_code16(LGUI(KC_V));
+ }
+ break;
+ }
+}
+#endif \ No newline at end of file
diff --git a/users/ninjonas/config.h b/users/ninjonas/config.h
index ae2370c5a1..025dbb541a 100644
--- a/users/ninjonas/config.h
+++ b/users/ninjonas/config.h
@@ -1,6 +1,6 @@
#ifdef TAPPING_TERM
#undef TAPPING_TERM
- #define TAPPING_TERM 300
+ #define TAPPING_TERM 200
#endif
// Mouse Settings: Smoothing out mouse movement on keypress
@@ -11,4 +11,11 @@
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 7
-#define MOUSEKEY_WHEEL_DELAY 0 \ No newline at end of file
+#define MOUSEKEY_WHEEL_DELAY 0
+
+#ifdef COMBO_ENABLE
+ #undef COMBO_COUNT
+ #undef COMBO_TERM
+ #define COMBO_COUNT 5
+ #define COMBO_TERM 60
+#endif \ No newline at end of file
diff --git a/users/ninjonas/encoder.c b/users/ninjonas/encoder.c
new file mode 100644
index 0000000000..3d56ff89ee
--- /dev/null
+++ b/users/ninjonas/encoder.c
@@ -0,0 +1,104 @@
+/* Copyright 2020 ninjonas
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "ninjonas.h"
+
+#ifdef ENCODER_ENABLE
+void left_encoder_cw(void) {
+ switch (get_highest_layer(layer_state)) {
+ case _LOWER:
+ tap_code16(LGUI(KC_TAB));
+ break;
+ case _RAISE:
+ tap_code(KC_PGDN);
+ break;
+ case _ADJUST:
+ rgblight_decrease_hue();
+ break;
+ default:
+ tap_code(KC_BRID);
+ break;
+ }
+}
+void left_encoder_acw(void) {
+ switch (get_highest_layer(layer_state)) {
+ case _LOWER:
+ tap_code16(SGUI(KC_TAB));
+ break;
+ case _RAISE:
+ tap_code(KC_PGUP);
+ break;
+ case _ADJUST:
+ rgblight_increase_hue();
+ break;
+ default:
+ tap_code(KC_BRIU);
+ break;
+ }
+}
+void right_encoder_cw(void) {
+ switch (get_highest_layer(layer_state)) {
+ case _LOWER:
+ tap_code(KC_DOWN);
+ break;
+ case _RAISE:
+ tap_code16(LCTL(LSFT(KC_TAB)));
+ break;
+ case _ADJUST:
+ rgblight_decrease_val();
+ break;
+ default:
+ tap_code(KC_VOLD);
+ break;
+ }
+}
+void right_encoder_acw(void) {
+ switch (get_highest_layer(layer_state)) {
+ case _LOWER:
+ tap_code(KC_UP);
+ break;
+ case _RAISE:
+ tap_code16(LCTL(KC_TAB));
+ break;
+ case _ADJUST:
+ rgblight_increase_val();
+ break;
+ default:
+ tap_code(KC_VOLU);
+ break;
+ }
+}
+
+void encoder_update_user(uint8_t index, bool clockwise) {
+ encoder_rotated_timer = timer_read();
+ if (index == 0) {
+ left_encoder_rotated = true;
+ if (clockwise) {
+ left_encoder_cw();
+ } else {
+ left_encoder_acw();
+ }
+ }
+ else if (index == 1) {
+ right_encoder_rotated = true;
+ if (clockwise) {
+ right_encoder_cw();
+ } else {
+ right_encoder_acw();
+ }
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h
index 6772957e27..94b4712a63 100644
--- a/users/ninjonas/ninjonas.h
+++ b/users/ninjonas/ninjonas.h
@@ -27,6 +27,12 @@
#include "split_util.h"
#endif
+#ifdef ENCODER_ENABLE
+bool left_encoder_rotated;
+bool right_encoder_rotated;
+uint16_t encoder_rotated_timer;
+#endif
+
#define _QWERTY 0
#define _DVORAK 1
#define _COLEMAK 2
@@ -40,24 +46,17 @@
#define K_CSCN LGUI(LCTL(LSFT(KC_4))) // Copy a portion of the screen to the clipboard
#define K_CPRF LGUI(LSFT(KC_M)) // Cmd + Shift + M. Used for switching Google Chrome profiles
#define K_MDSH LSFT(LALT(KC_MINS))
-#define K_LAPP SGUI(KC_TAB) // Cmd + Shift + Tab
-#define K_RAPP LGUI(KC_TAB) // Cmd + Tab
// Layer Keys
-#define LM_LOW MO(_LOWER)
-#define LM_RAI MO(_RAISE)
-#define LG_LOW TG(_LOWER)
-#define LG_RAI TG(_RAISE)
-#define LG_NUM TG(_NUMPAD)
#define LT_LOW LT(_LOWER, KC_ENT)
#define LT_RAI LT(_RAISE, KC_SPC)
// Mod-Tap Keys
-#define MT_DEL MT(MOD_LGUI | MOD_LALT | MOD_LSFT, KC_DEL)
-#define MT_EQL MT(MOD_LALT | MOD_LSFT, KC_EQL)
+#define MT_DEL MT(MOD_LALT | MOD_LSFT, KC_DEL)
+#define MT_EQL MT(MOD_RSFT, KC_EQL)
// Layout blocks
-#define _____________________QWERTY_L1______________________ T_TAB, T_Q, KC_W, KC_E, KC_R, KC_T
+#define _____________________QWERTY_L1______________________ T_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T
#define _____________________QWERTY_L2______________________ T_ESC, KC_A, KC_S, KC_D, KC_F, KC_G
#define _____________________QWERTY_L3______________________ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B
@@ -130,7 +129,7 @@
#define __________________________________ _______, _______, _______, _______
#define _____________MOD_LEFT_____________ KC_LALT, T_GUI, KC_LCTL, LT_RAI
-#define _____________MOD_RIGHT____________ LT_LOW, KC_BSPC, MT_DEL, T_CPNU
+#define _____________MOD_RIGHT____________ LT_LOW, KC_BSPC, MT_DEL, T_CPAP
#define _________MEDIA_1_________ KC_BRIU, KC_MPLY, KC_MUTE
#define _________MEDIA_2_________ KC_BRID, KC_MFFD, KC__VOLUP
@@ -141,7 +140,7 @@
#define ________MOD_RIGHT________ LT_LOW, KC_BSPC, MT_DEL
#else
#define ________MOD_LEFT_________ KC_LALT, T_GUI, KC_LCTL
- #define ________MOD_RIGHT________ KC_BSPC, MT_DEL, T_CPNU
+ #define ________MOD_RIGHT________ KC_BSPC, MT_DEL, T_CPAP
#endif
// Layout wrappers
diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c
index b4a5e35d13..a3b8417913 100644
--- a/users/ninjonas/process_records.c
+++ b/users/ninjonas/process_records.c
@@ -1,7 +1,5 @@
#include "ninjonas.h"
-uint16_t copy_paste_timer;
-
__attribute__((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
@@ -92,18 +90,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
break;
- // Single key copy/paste
- case M_COPA:
- if (record->event.pressed) {
- copy_paste_timer = timer_read();
- } else {
- if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) {
- tap_code16(LGUI(KC_C)); // Hold Cmd + C
- } else {
- tap_code16(LGUI(KC_V)); // Tap Cmd + V
- }
- }
-
// BEGIN: Layer macros
case QWERTY:
if (record->event.pressed) {
diff --git a/users/ninjonas/process_records.h b/users/ninjonas/process_records.h
index 34886531a5..2e69ca2163 100644
--- a/users/ninjonas/process_records.h
+++ b/users/ninjonas/process_records.h
@@ -15,7 +15,6 @@ enum custom_keycodes {
M_VRSN,
M_CODE,
M_TERM,
- M_COPA,
// Secret Macros
M_XXX1,
M_XXX2,
diff --git a/users/ninjonas/rules.mk b/users/ninjonas/rules.mk
index 7b77e153d3..a5cd0fdd9c 100644
--- a/users/ninjonas/rules.mk
+++ b/users/ninjonas/rules.mk
@@ -2,11 +2,14 @@ BOOTMAGIC_ENABLE = no # Disable Boot Magic (https://beta.docs.qmk.fm/featu
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
TAP_DANCE_ENABLE = yes # Enable Tap Dance.
+COMBO_ENABLE = yes # Enable Combos
SRC += ninjonas.c \
process_records.c \
tap_dances.c \
- oled.c
+ oled.c \
+ encoder.c \
+ combos.c
ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
SRC += secrets.c
diff --git a/users/ninjonas/tap_dances.c b/users/ninjonas/tap_dances.c
index ece95887a7..63e4d3ba47 100644
--- a/users/ninjonas/tap_dances.c
+++ b/users/ninjonas/tap_dances.c
@@ -2,28 +2,41 @@
//// BEGIN: Advanced Tap Dances
int cur_dance (qk_tap_dance_state_t *state) {
- if (state->count == 1) {
- if (!state->pressed) {
- return SINGLE_TAP;
- } else {
- return SINGLE_HOLD;
- }
- } else if (state->count == 2) {
- return DOUBLE_TAP;
+ if (state->count == 1) {
+ if (state->interrupted || !state->pressed) return SINGLE_TAP;
+ //key has not been interrupted, but they key is still held. Means you want to send a 'HOLD'.
+ else return SINGLE_HOLD;
}
- else return 8;
+ else if (state->count == 2) {
+ /*
+ * DOUBLE_SINGLE_TAP is to distinguish between typing "pepper", and actually wanting a double tap
+ * action when hitting 'pp'. Suggested use case for this return value is when you want to send two
+ * keystrokes of the key, and not the 'double tap' action/macro.
+ */
+ if (state->interrupted) return DOUBLE_SINGLE_TAP;
+ else if (state->pressed) return DOUBLE_HOLD;
+ else return DOUBLE_TAP;
+ }
+ //Assumes no one is trying to type the same letter three times (at least not quickly).
+ //If your tap dance key is 'KC_W', and you want to type "www." quickly - then you will need to add
+ //an exception here to return a 'TRIPLE_SINGLE_TAP', and define that enum just like 'DOUBLE_SINGLE_TAP'
+ if (state->count == 3) {
+ if (state->interrupted || !state->pressed) return TRIPLE_TAP;
+ else return TRIPLE_HOLD;
+ }
+ else return 8; //magic number. At some point this method will expand to work for more presses
}
-// BEGIN: Copy, Paste, NUMPAD
+// BEGIN: Copy, Paste, Apps
// https://beta.docs.qmk.fm/features/feature_tap_dance#example-6-using-tap-dance-for-momentary-layer-switch-and-layer-toggle-keys
-static tap copy_paste_numpad_tap_state = {
+static tap copy_paste_app_tap_state = {
.is_press_action = true,
.state = 0
};
-void copy_paste_numpad_finished (qk_tap_dance_state_t *state, void *user_data) {
- copy_paste_numpad_tap_state.state = cur_dance(state);
- switch (copy_paste_numpad_tap_state.state) {
+void copy_paste_app_finished (qk_tap_dance_state_t *state, void *user_data) {
+ copy_paste_app_tap_state.state = cur_dance(state);
+ switch (copy_paste_app_tap_state.state) {
case SINGLE_TAP:
tap_code16(LGUI(KC_V)); // Tap Cmd + V
break;
@@ -31,19 +44,22 @@ void copy_paste_numpad_finished (qk_tap_dance_state_t *state, void *user_data) {
tap_code16(LGUI(KC_C)); // Hold Cmd + C
break;
case DOUBLE_TAP:
- if (layer_state_is(_NUMPAD)) {
- layer_off(_NUMPAD);
- } else {
- layer_on(_NUMPAD);
- }
+ SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI));
+ wait_ms(250);
+ SEND_STRING("line\n");
+ break;
+ case TRIPLE_TAP:
+ SEND_STRING(SS_DOWN(X_LGUI) SS_TAP(X_SPACE) SS_UP(X_LGUI));
+ wait_ms(250);
+ SEND_STRING("itunes\n");
break;
}
}
-void copy_paste_numpad_reset (qk_tap_dance_state_t *state, void *user_data) {
- copy_paste_numpad_tap_state.state = 0;
+void copy_paste_app_reset (qk_tap_dance_state_t *state, void *user_data) {
+ copy_paste_app_tap_state.state = 0;
}
-// END: Copy, Paste, NUMPAD
+// END: Copy, Paste, Apps
// BEGIN: Y, NUMPAD
static tap y_numpad_tap_state = {
@@ -89,10 +105,8 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[TD_TAB_CTRLTAB] = ACTION_TAP_DANCE_DOUBLE(KC_TAB, LCTL(KC_TAB)),
[TD_GRV_CTRLGRV] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, LGUI(KC_GRV)),
[TD_GUI_GUISPC] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, LGUI(KC_SPC)),
- [TD_W_CTRLW] = ACTION_TAP_DANCE_DOUBLE(KC_W, LGUI(KC_W)),
- [TD_Q_GUIQ] = ACTION_TAP_DANCE_DOUBLE(KC_Q, LGUI(KC_Q)),
// Advanced Tap Dances
- [TD_COPY_PASTE_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, copy_paste_numpad_finished, copy_paste_numpad_reset),
- [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, y_numpad_finished, y_numpad_reset),
+ [TD_COPY_PASTE_APP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, copy_paste_app_finished, copy_paste_app_reset, 300),
+ [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, y_numpad_finished, y_numpad_reset, 300),
}; \ No newline at end of file
diff --git a/users/ninjonas/tap_dances.h b/users/ninjonas/tap_dances.h
index f2f39108dc..11f77e7171 100644
--- a/users/ninjonas/tap_dances.h
+++ b/users/ninjonas/tap_dances.h
@@ -9,7 +9,11 @@ typedef struct {
enum tapdance_types{
SINGLE_TAP = 1,
SINGLE_HOLD = 2,
- DOUBLE_TAP = 3
+ DOUBLE_TAP = 3,
+ DOUBLE_HOLD = 4,
+ DOUBLE_SINGLE_TAP = 5, //send two single taps
+ TRIPLE_TAP = 6,
+ TRIPLE_HOLD = 7
};
enum custom_tapdances{
@@ -19,9 +23,7 @@ enum custom_tapdances{
TD_TAB_CTRLTAB,
TD_GRV_CTRLGRV,
TD_GUI_GUISPC,
- TD_W_CTRLW,
- TD_Q_GUIQ,
- TD_COPY_PASTE_NUMPAD,
+ TD_COPY_PASTE_APP,
TD_Y_NUMPAD,
};
@@ -31,7 +33,5 @@ enum custom_tapdances{
#define T_TAB TD(TD_TAB_CTRLTAB) // Tap for TAB, double tap for CTRL + TAB
#define T_GRV TD(TD_GRV_CTRLGRV) // Tap for GRV, double tap for Cmd + GRV
#define T_GUI TD(TD_GUI_GUISPC) // Tap for Cmd, double tap for Cmd + Space
-#define T_W TD(TD_W_CTRLW) // Tap for W, double tap for Cmd + W
-#define T_Q TD(TD_Q_GUIQ) // Tap for Q, double tap for Cmd + Q
-#define T_CPNU TD(TD_COPY_PASTE_NUMPAD) // Tap for paste, hold for copy, double tap for NUMPAD
+#define T_CPAP TD(TD_COPY_PASTE_APP) // Tap for paste, hold for copy, double tap for Line App
#define T_Y TD(TD_Y_NUMPAD) // Tap for Y, double tap for NUMPAD \ No newline at end of file