summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Avellana <14019120+ninjonas@users.noreply.github.com>2020-03-13 17:56:21 -0600
committerGitHub <noreply@github.com>2020-03-13 16:56:21 -0700
commit0fdd37ee19d07d6f15217074dd3291fda4c4cb2f (patch)
tree595a398a2977755695c1903cdf71b6fcf2ce03aa
parent40e8d60ecd68c1c43e1fc911e993626943930fd0 (diff)
[Keymap] ninjonas keymap updates (#8373)
* [keymap(ninjonas)] ninjonas keymap updates * [refactor] switching encoder rotation logic. recent pull seems to have flipped encoder stuff * [keymap(lily58)] added chrome change profile key on RAISE Co-authored-by: Jonas Avellana <jonas.avellana@workday.com>
-rw-r--r--keyboards/crkbd/keymaps/ninjonas/config.h2
-rw-r--r--keyboards/kyria/keymaps/ninjonas/config.h2
-rw-r--r--keyboards/kyria/keymaps/ninjonas/encoder.c84
-rw-r--r--keyboards/kyria/keymaps/ninjonas/keymap.c6
-rw-r--r--keyboards/kyria/keymaps/ninjonas/oled.c40
-rw-r--r--keyboards/kyria/keymaps/ninjonas/rules.mk3
-rw-r--r--keyboards/lily58/keymaps/ninjonas/keymap.c2
-rw-r--r--keyboards/lily58/keymaps/ninjonas/rules.mk1
-rw-r--r--keyboards/pinky/3/keymaps/ninjonas/config.h2
-rw-r--r--keyboards/pinky/3/keymaps/ninjonas/keymap.c6
-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
20 files changed, 293 insertions, 173 deletions
diff --git a/keyboards/crkbd/keymaps/ninjonas/config.h b/keyboards/crkbd/keymaps/ninjonas/config.h
index 33fe4a5c9b..8a4ddad748 100644
--- a/keyboards/crkbd/keymaps/ninjonas/config.h
+++ b/keyboards/crkbd/keymaps/ninjonas/config.h
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
-#define TAPPING_TERM 300
+#define TAPPING_TERM 200
#define MASTER_LEFT
diff --git a/keyboards/kyria/keymaps/ninjonas/config.h b/keyboards/kyria/keymaps/ninjonas/config.h
index dd919e382f..5673e6c3d8 100644
--- a/keyboards/kyria/keymaps/ninjonas/config.h
+++ b/keyboards/kyria/keymaps/ninjonas/config.h
@@ -16,7 +16,7 @@
#pragma once
-#define TAPPING_TERM 300
+#define TAPPING_TERM 200
#ifdef OLED_DRIVER_ENABLE
#define OLED_DISPLAY_128X64
diff --git a/keyboards/kyria/keymaps/ninjonas/encoder.c b/keyboards/kyria/keymaps/ninjonas/encoder.c
deleted file mode 100644
index e3a4f26616..0000000000
--- a/keyboards/kyria/keymaps/ninjonas/encoder.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 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 encoder_update_user(uint8_t index, bool clockwise) {
- if (index == 0) {
- switch (get_highest_layer(layer_state)) {
- case _LOWER:
- if (clockwise) {
- tap_code16(SGUI(KC_TAB));
- } else {
- tap_code16(LGUI(KC_TAB));
- }
- break;
- case _RAISE:
- if (clockwise) {
- tap_code(KC_PGUP);
- } else {
- tap_code(KC_PGDN);
- }
- break;
- case _ADJUST:
- if (clockwise) {
- rgblight_increase_hue();
- } else {
- rgblight_decrease_hue();
- }
- break;
- default:
- if (clockwise) {
- tap_code(KC_BRIU);
- } else {
- tap_code(KC_BRID);
- }
- break;
- }
- } else if (index == 1) {
- switch (get_highest_layer(layer_state)) {
- case _LOWER:
- if (clockwise) {
- tap_code(KC_UP);
- } else {
- tap_code(KC_DOWN);
- }
- break;
- case _RAISE:
- if (clockwise) {
- tap_code16(LCTL(KC_TAB));
- } else {
- tap_code16(LCTL(LSFT(KC_TAB)));
- }
- break;
- case _ADJUST:
- if (clockwise) {
- rgblight_increase_val();
- } else {
- rgblight_decrease_val();
- }
- break;
- default:
- if (clockwise) {
- tap_code(KC_VOLU);
- } else {
- tap_code(KC_VOLD);
- }
- break;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/keyboards/kyria/keymaps/ninjonas/keymap.c b/keyboards/kyria/keymaps/ninjonas/keymap.c
index df492a4661..ae4b3b7ba9 100644
--- a/keyboards/kyria/keymaps/ninjonas/keymap.c
+++ b/keyboards/kyria/keymaps/ninjonas/keymap.c
@@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------|
_____________________QWERTY_L2______________________, _____________________QWERTY_R2______________________,
// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------|
- _____________________QWERTY_L3______________________,XXXXXXX,KC_LALT, T_CPNU,XXXXXXX,_____________________QWERTY_R3______________________,
+ _____________________QWERTY_L3______________________,XXXXXXX,KC_LALT, T_CPAP,XXXXXXX,_____________________QWERTY_R3______________________,
// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------'
_____________MOD_LEFT_____________,T_LBRC, T_RBRC,________MOD_RIGHT________,KC_MUTE
// `----------------------------------------' `----------------------------------------'
@@ -36,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------|
_____________________DVORAK_L2______________________, _____________________DVORAK_R2______________________,
// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------|
- _____________________DVORAK_L3______________________,XXXXXXX,KC_LALT, T_CPNU,XXXXXXX,_____________________DVORAK_R3______________________,
+ _____________________DVORAK_L3______________________,XXXXXXX,KC_LALT, T_CPAP,XXXXXXX,_____________________DVORAK_R3______________________,
// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------'
_____________MOD_LEFT_____________,T_LBRC, T_RBRC,________MOD_RIGHT________,KC_MUTE
// `----------------------------------------' `----------------------------------------'
@@ -48,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------|
_____________________COLEMAK_L2_____________________, _____________________COLEMAK_R2_____________________,
// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------|
- _____________________COLEMAK_L3_____________________,XXXXXXX,KC_LALT, T_CPNU,XXXXXXX,_____________________COLEMAK_R3_____________________,
+ _____________________COLEMAK_L3_____________________,XXXXXXX,KC_LALT, T_CPAP,XXXXXXX,_____________________COLEMAK_R3_____________________,
// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------'
_____________MOD_LEFT_____________,T_LBRC, T_RBRC,________MOD_RIGHT________,KC_MUTE
// `----------------------------------------' `----------------------------------------'
diff --git a/keyboards/kyria/keymaps/ninjonas/oled.c b/keyboards/kyria/keymaps/ninjonas/oled.c
index 419c1b7277..65976205b7 100644
--- a/keyboards/kyria/keymaps/ninjonas/oled.c
+++ b/keyboards/kyria/keymaps/ninjonas/oled.c
@@ -105,8 +105,12 @@ void oled_white_space(void){
oled_write_P(PSTR(" "), false);
}
+void oled_slash_separator(void){
+ oled_write_P(PSTR(" / "), false);
+}
+
void render_layout_state(void) {
- oled_write_P(PSTR("\nLayout: "), false);
+ oled_write_P(PSTR("Layout: "), false);
switch (biton32(default_layer_state)) {
case _COLEMAK:
oled_write_P(PSTR("Colemak"), false);
@@ -121,6 +125,37 @@ void render_layout_state(void) {
oled_write_ln_P(PSTR("Undefined"), false);
}
}
+#ifdef ENCODER_ENABLE
+static void render_encoder_state(void) {
+ oled_write_P(PSTR("\nEnc: "), false);
+ bool lower = layer_state_is(_LOWER) & !layer_state_is(_ADJUST);
+ bool raise = layer_state_is(_RAISE) & !layer_state_is(_ADJUST);
+ bool adjust = layer_state_is(_ADJUST);
+
+ if(lower){
+ oled_write_P(PSTR("APPSW"), left_encoder_rotated);
+ oled_slash_separator();
+ oled_write_P(PSTR("UPDN"), right_encoder_rotated);
+ } else if(raise){
+ oled_write_P(PSTR("PGUD"), left_encoder_rotated);
+ oled_slash_separator();
+ oled_write_P(PSTR("TABSW"), right_encoder_rotated);
+ } else if(adjust){
+ oled_write_P(PSTR("RHUE"), left_encoder_rotated);
+ oled_slash_separator();
+ oled_write_P(PSTR("RBRI"), right_encoder_rotated);
+ } else {
+ oled_write_P(PSTR("BRI"), left_encoder_rotated);
+ oled_slash_separator();
+ oled_write_P(PSTR("VOL"), right_encoder_rotated);
+ }
+
+ if (timer_elapsed(encoder_rotated_timer) > 200) {
+ left_encoder_rotated = false;
+ right_encoder_rotated = false;
+ }
+}
+#endif
static void render_layer_state(void) {
oled_write_P(PSTR("\nLayer:"), false);
@@ -156,6 +191,9 @@ void render_mod_state(uint8_t modifiers) {
static void render_status(void) {
render_qmk_logo();
render_layout_state();
+ #ifdef ENCODER_ENABLE
+ render_encoder_state();
+ #endif
render_layer_state();
render_mod_state(get_mods()|get_oneshot_mods());
}
diff --git a/keyboards/kyria/keymaps/ninjonas/rules.mk b/keyboards/kyria/keymaps/ninjonas/rules.mk
index 3b2894a175..e7e4726bac 100644
--- a/keyboards/kyria/keymaps/ninjonas/rules.mk
+++ b/keyboards/kyria/keymaps/ninjonas/rules.mk
@@ -3,5 +3,4 @@ ENCODER_ENABLE = yes # Enables the use of one or more encoders
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
LINK_TIME_OPTIMIZATION_ENABLE = yes
-SRC += encoder.c \
- oled.c \ No newline at end of file
+SRC += oled.c \ No newline at end of file
diff --git a/keyboards/lily58/keymaps/ninjonas/keymap.c b/keyboards/lily58/keymaps/ninjonas/keymap.c
index 2976f9eaf3..6d2f1c3213 100644
--- a/keyboards/lily58/keymaps/ninjonas/keymap.c
+++ b/keyboards/lily58/keymaps/ninjonas/keymap.c
@@ -125,7 +125,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
XXXXXXX, XXXXXXX, _____________MOUSE_1______________, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, _____________MOUSE_2______________, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
- __________________________________, __________________________________
+ __________________________________, _______, _______, _______, K_CPRF
),
/* ADJUST
diff --git a/keyboards/lily58/keymaps/ninjonas/rules.mk b/keyboards/lily58/keymaps/ninjonas/rules.mk
index c582662134..dc3fe55bca 100644
--- a/keyboards/lily58/keymaps/ninjonas/rules.mk
+++ b/keyboards/lily58/keymaps/ninjonas/rules.mk
@@ -1 +1,2 @@
OLED_DRIVER_ENABLE = yes
+LINK_TIME_OPTIMIZATION_ENABLE = yes \ No newline at end of file
diff --git a/keyboards/pinky/3/keymaps/ninjonas/config.h b/keyboards/pinky/3/keymaps/ninjonas/config.h
index ff8cd8bb09..585bd8cb5d 100644
--- a/keyboards/pinky/3/keymaps/ninjonas/config.h
+++ b/keyboards/pinky/3/keymaps/ninjonas/config.h
@@ -27,5 +27,5 @@
#define USE_SERIAL_PD2
#define TAPPING_FORCE_HOLD
-#define TAPPING_TERM 300
+#define TAPPING_TERM 200
#define RETRO_TAPPPING \ No newline at end of file
diff --git a/keyboards/pinky/3/keymaps/ninjonas/keymap.c b/keyboards/pinky/3/keymaps/ninjonas/keymap.c
index 2b93c5aa8e..8aac3541fe 100644
--- a/keyboards/pinky/3/keymaps/ninjonas/keymap.c
+++ b/keyboards/pinky/3/keymaps/ninjonas/keymap.c
@@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
_____________________QWERTY_L3______________________, LT_RAI, LT_LOW, _____________________QWERTY_R3______________________,
//|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
- ________MOD_LEFT_________, K_LAPP, K_RAPP, ________MOD_RIGHT________
+ ________MOD_LEFT_________, XXXXXXX, XXXXXXX, ________MOD_RIGHT________
//`---------------------------------------' `---------------------------------------'
),
@@ -43,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
_____________________DVORAK_L3______________________, LT_RAI, LT_LOW, _____________________DVORAK_R3______________________,
//|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
- ________MOD_LEFT_________, K_LAPP, K_RAPP, ________MOD_RIGHT________
+ ________MOD_LEFT_________, XXXXXXX, XXXXXXX, ________MOD_RIGHT________
//`---------------------------------------' `---------------------------------------'
),
@@ -55,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
//|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
_____________________COLEMAK_L3_____________________, LT_RAI, LT_LOW, _____________________COLEMAK_R3_____________________,
//|---------+---------+---------+---------+---------+---------+---------| |---------+---------+---------+---------+---------+---------+---------|
- ________MOD_LEFT_________, K_LAPP, K_RAPP, ________MOD_RIGHT________
+ ________MOD_LEFT_________, XXXXXXX, XXXXXXX, ________MOD_RIGHT________
//`---------------------------------------' `---------------------------------------'
),
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)),