diff options
| author | Fredrik Salomonsson <plattfot@gmail.com> | 2020-07-10 15:00:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-10 23:00:04 +0100 |
| commit | 21610d245ac0a7fe9a8fe76669bbf9b8aec78aab (patch) | |
| tree | f679342a36c613b647f4fc82c8df77ffc7f8c1f3 | |
| parent | bdfb1bc2b5e51e2b5f8844a0f6106162931c9ca8 (diff) | |
| download | qmk_firmware-21610d245ac0a7fe9a8fe76669bbf9b8aec78aab.tar.gz qmk_firmware-21610d245ac0a7fe9a8fe76669bbf9b8aec78aab.zip | |
[Keymap] plattfot - Update and fix issue with DBL_TAP (#9666)
- Fix typo in the default layout.
- Move esc and del to the navi layer.
- Fix issue with oneshot layers and double tap aka DBL_TAP.
- Add caps lock to the raise layer.
Was relying on a broken behavior for the double tap to work with
oneshot keys, i.e. the oneshot layer not being cleared after a key
press in `process_record_user`, which allowed me to first press an
oneshot key, then double tap and then a key. With the behavior fixed,
this no longer works. As the oneshot layer will be cleared when double
tap is pressed.
To make double tap useful again. I changed that any of the layer keys
does not clear the double tap. Which allows me for example to first
press double tap, then an oneshot key and then a key. So now I'm able
to type my double symbols again.
| -rw-r--r-- | keyboards/kyria/keymaps/plattfot/README.md | 16 | ||||
| -rw-r--r-- | keyboards/kyria/keymaps/plattfot/keymap.c | 31 |
2 files changed, 26 insertions, 21 deletions
diff --git a/keyboards/kyria/keymaps/plattfot/README.md b/keyboards/kyria/keymaps/plattfot/README.md index b5b6ddaa2..860a3b782 100644 --- a/keyboards/kyria/keymaps/plattfot/README.md +++ b/keyboards/kyria/keymaps/plattfot/README.md | |||
| @@ -21,8 +21,8 @@ thumb keys to make it work without them. | |||
| 21 | // |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| | 21 | // |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| |
| 22 | // | LShift | Z | X | C | V | B | Lead | RAISE| | LOWER|DBLTAP| N | M | , < | . > | / ? | RShift | | 22 | // | LShift | Z | X | C | V | B | Lead | RAISE| | LOWER|DBLTAP| N | M | , < | . > | / ? | RShift | |
| 23 | // `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' | 23 | // `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' |
| 24 | // | MPlay| GUI | LCtrl| Space| LALT | | Enter|BSpace| NAV | LAlt |Worksp| | 24 | // | MPlay| GUI | LCtrl| Space| LALT | | Enter|BSpace| NAV | LCTL+|Worksp| |
| 25 | // | | | | | | | | | | |toggle| | 25 | // | | | | | | | | | | LALT |toggle| |
| 26 | // `----------------------------------' `----------------------------------' | 26 | // `----------------------------------' `----------------------------------' |
| 27 | ``` | 27 | ``` |
| 28 | 28 | ||
| @@ -103,9 +103,9 @@ programming, and it is editor agnostic. | |||
| 103 | // |--------+------+------+------+------+------| |------+------+------+------+------+--------| | 103 | // |--------+------+------+------+------+------| |------+------+------+------+------+--------| |
| 104 | // | | | | | | F11 | | F12 | | | | | | | 104 | // | | | | | | F11 | | F12 | | | | | | |
| 105 | // |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| | 105 | // |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| |
| 106 | // | | | | | | |ScLock| | | | Ins | | | | | | | | 106 | // | | | | | | |ScLock| | | | Ins | | | | | |CapsLock| |
| 107 | // `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' | 107 | // `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' |
| 108 | // | | | | | | | Esc | Del | | RAlt | | | 108 | // | | | | | | | | | | RAlt | | |
| 109 | // | | | | | | | | | | | | | 109 | // | | | | | | | | | | | | |
| 110 | // `----------------------------------' `----------------------------------' | 110 | // `----------------------------------' `----------------------------------' |
| 111 | ``` | 111 | ``` |
| @@ -113,6 +113,9 @@ programming, and it is editor agnostic. | |||
| 113 | Access to the functional keys, which I mostly use to run `emacs` | 113 | Access to the functional keys, which I mostly use to run `emacs` |
| 114 | compilation mode. | 114 | compilation mode. |
| 115 | 115 | ||
| 116 | This layer also includes key that changes the state, like insert and | ||
| 117 | caps lock. | ||
| 118 | |||
| 116 | Scroll Lock is used to toggle between English and Swedish. | 119 | Scroll Lock is used to toggle between English and Swedish. |
| 117 | 120 | ||
| 118 | ## Notable features on this layer | 121 | ## Notable features on this layer |
| @@ -130,7 +133,7 @@ Right rotary encoder | |||
| 130 | // ,-------------------------------------------. ,-------------------------------------------. | 133 | // ,-------------------------------------------. ,-------------------------------------------. |
| 131 | // | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | | 134 | // | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | |
| 132 | // |--------+------+------+------+------+------| |------+------+------+------+------+--------| | 135 | // |--------+------+------+------+------+------| |------+------+------+------+------+--------| |
| 133 | // | | | | | | | | | Left | Up | Down | Right| | | 136 | // | | | ESC | DEL | | | | | Left | Up | Down | Right| | |
| 134 | // |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| | 137 | // |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| |
| 135 | // | | | | | | | | | | | | | | | | | | | 138 | // | | | | | | | | | | | | | | | | | | |
| 136 | // `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' | 139 | // `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' |
| @@ -144,6 +147,9 @@ row after using [ErgoDox](https://www.ergodox.io/) keyboards for a few | |||
| 144 | years. Do not feel I need a numpad layer, which seems to be quite | 147 | years. Do not feel I need a numpad layer, which seems to be quite |
| 145 | common with small keyboards like this. | 148 | common with small keyboards like this. |
| 146 | 149 | ||
| 150 | Esc and Delete is also on this layer as they are easy to reach and they | ||
| 151 | only need to be chord with the modifiers. | ||
| 152 | |||
| 147 | # Adjust Layer: RGB | 153 | # Adjust Layer: RGB |
| 148 | ``` | 154 | ``` |
| 149 | // | 155 | // |
diff --git a/keyboards/kyria/keymaps/plattfot/keymap.c b/keyboards/kyria/keymaps/plattfot/keymap.c index d89776989..3bd3489f6 100644 --- a/keyboards/kyria/keymaps/plattfot/keymap.c +++ b/keyboards/kyria/keymaps/plattfot/keymap.c | |||
| @@ -52,8 +52,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 52 | * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| | 52 | * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| |
| 53 | * | LShift | Z | X | C | V | B | Lead | RAISE| | LOWER|DBLTAP| N | M | , < | . > | / ? | RShift | | 53 | * | LShift | Z | X | C | V | B | Lead | RAISE| | LOWER|DBLTAP| N | M | , < | . > | / ? | RShift | |
| 54 | * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' | 54 | * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' |
| 55 | * | MPlay| GUI | LCtrl| Space| LALT | | Enter|BSpace| NAV | LAlt |Worksp| | 55 | * | MPlay| GUI | LCtrl| Space| LALT | | Enter|BSpace| NAV |LCTL+ |Worksp| |
| 56 | * | | | | | | | | | | |toggle| | 56 | * | | | | | | | | | |LALT |toggle| |
| 57 | * `----------------------------------' `----------------------------------' | 57 | * `----------------------------------' `----------------------------------' |
| 58 | */ | 58 | */ |
| 59 | [_DEFAULT] = LAYOUT( | 59 | [_DEFAULT] = LAYOUT( |
| @@ -91,26 +91,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 91 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | 91 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| |
| 92 | * | | | | | | F11 | | F12 | | | | | | | 92 | * | | | | | | F11 | | F12 | | | | | | |
| 93 | * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| | 93 | * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| |
| 94 | * | | | | | | |ScLock| | | | Ins | | | | | | | | 94 | * | | | | | | |ScLock| | | | Ins | | | | | |CapsLock| |
| 95 | * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' | 95 | * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' |
| 96 | * | | | | | | | Esc | Del | | RAlt | | | 96 | * | | | | | | | | | | RAlt | | |
| 97 | * | | | | | | | | | | | | | 97 | * | | | | | | | | | | | | |
| 98 | * `----------------------------------' `----------------------------------' | 98 | * `----------------------------------' `----------------------------------' |
| 99 | */ | 99 | */ |
| 100 | [_RAISE] = LAYOUT( | 100 | [_RAISE] = LAYOUT( |
| 101 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, | 101 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, |
| 102 | _______, _______, _______, _______, _______, KC_F11, KC_F12, _______, _______, _______, _______, _______, | 102 | _______, _______, _______, _______, _______, KC_F11, KC_F12, _______, _______, _______, _______, _______, |
| 103 | _______, _______, _______, _______, _______, _______, KC_SLCK, _______, _______, KC_INS, _______, _______, _______, _______, _______, _______, | 103 | _______, _______, _______, _______, _______, _______, KC_SLCK, _______, _______, KC_INS, _______, _______, _______, _______, _______, KC_CAPS, |
| 104 | _______, _______, _______, _______, _______, KC_ESC, KC_DEL, _______, KC_RALT, _______ | 104 | _______, _______, _______, _______, _______, _______, _______, _______, KC_RALT, _______ |
| 105 | 105 | ||
| 106 | ), | 106 | ), |
| 107 | /* | 107 | /* |
| 108 | * Navigation Layer: Number keys, navigation | 108 | * Navigation Layer: Number keys, navigation, modification |
| 109 | * | 109 | * |
| 110 | * ,-------------------------------------------. ,-------------------------------------------. | 110 | * ,-------------------------------------------. ,-------------------------------------------. |
| 111 | * | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | | 111 | * | | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | |
| 112 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| | 112 | * |--------+------+------+------+------+------| |------+------+------+------+------+--------| |
| 113 | * | | | | | | | | | Left | Up | Down | Right| | | 113 | * | | | Esc | Del | | | | | Left | Up | Down | Right| | |
| 114 | * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| | 114 | * |--------+------+------+------+------+------+-------------. ,-------------+------+------+------+------+------+--------| |
| 115 | * | | | | | | | | | | | | | | | | | | | 115 | * | | | | | | | | | | | | | | | | | | |
| 116 | * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' | 116 | * `----------------------+------+------+------+------+------| |------+------+------+------+------+----------------------' |
| @@ -120,7 +120,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 120 | */ | 120 | */ |
| 121 | [_NAV] = LAYOUT( | 121 | [_NAV] = LAYOUT( |
| 122 | _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, | 122 | _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, |
| 123 | _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, _______, | 123 | _______, _______, KC_ESC, KC_DEL, _______, _______, _______, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, _______, |
| 124 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 124 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
| 125 | _______, _______, _______, _______, _______, _______, _______, _______, KC_RCTL, _______ | 125 | _______, _______, _______, _______, _______, _______, _______, _______, KC_RCTL, _______ |
| 126 | ), | 126 | ), |
| @@ -177,27 +177,22 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 177 | // Double tap gets messed up with macros, turning it off | 177 | // Double tap gets messed up with macros, turning it off |
| 178 | double_tap_it = false; | 178 | double_tap_it = false; |
| 179 | SEND_STRING("()" SS_TAP(X_LEFT)); | 179 | SEND_STRING("()" SS_TAP(X_LEFT)); |
| 180 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | ||
| 181 | return false; | 180 | return false; |
| 182 | case M_LRCBR: | 181 | case M_LRCBR: |
| 183 | double_tap_it = false; | 182 | double_tap_it = false; |
| 184 | SEND_STRING("{}" SS_TAP(X_LEFT)); | 183 | SEND_STRING("{}" SS_TAP(X_LEFT)); |
| 185 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | ||
| 186 | return false; | 184 | return false; |
| 187 | case M_LRBRC: | 185 | case M_LRBRC: |
| 188 | double_tap_it = false; | 186 | double_tap_it = false; |
| 189 | SEND_STRING("[]" SS_TAP(X_LEFT)); | 187 | SEND_STRING("[]" SS_TAP(X_LEFT)); |
| 190 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | ||
| 191 | return false; | 188 | return false; |
| 192 | case M_LRABR: | 189 | case M_LRABR: |
| 193 | double_tap_it = false; | 190 | double_tap_it = false; |
| 194 | SEND_STRING("<>" SS_TAP(X_LEFT)); | 191 | SEND_STRING("<>" SS_TAP(X_LEFT)); |
| 195 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | ||
| 196 | return false; | 192 | return false; |
| 197 | case M_DQUOT: | 193 | case M_DQUOT: |
| 198 | double_tap_it = false; | 194 | double_tap_it = false; |
| 199 | SEND_STRING("''" SS_TAP(X_LEFT)); | 195 | SEND_STRING("''" SS_TAP(X_LEFT)); |
| 200 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | ||
| 201 | return false; | 196 | return false; |
| 202 | case DBL_TAP: | 197 | case DBL_TAP: |
| 203 | double_tap_it = !double_tap_it; | 198 | double_tap_it = !double_tap_it; |
| @@ -206,10 +201,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 206 | double_tap_it = false; | 201 | double_tap_it = false; |
| 207 | return true; | 202 | return true; |
| 208 | } | 203 | } |
| 209 | } else if (double_tap_it && keycode != DBL_TAP) { | 204 | |
| 205 | } else if (double_tap_it && | ||
| 206 | keycode != DBL_TAP && | ||
| 207 | keycode != OSL(_RAISE) && | ||
| 208 | keycode != OSL(_LOWER) && | ||
| 209 | keycode != MO(_NAV)) { | ||
| 210 | double_tap_it = false; | 210 | double_tap_it = false; |
| 211 | tap_code16(keycode); | 211 | tap_code16(keycode); |
| 212 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | ||
| 213 | } | 212 | } |
| 214 | 213 | ||
| 215 | return true; | 214 | return true; |
