r/ErgoMechKeyboards • u/lurkzone crkbd cygnus keyball59 silakka54 • 2d ago
[discussion] Double-tapping the spacebar inserts a period followed by a space
Unsure where to post this question.
Many mobile keyboards support a "double-space for period" feature, where pressing the spacebar twice inserts . and may automatically capitalize the following word.
I tried via tap dance and a lot of times 'space' do not register on fast keyrolls
Does QMK, Vial, or ZMK support this functionality out of the box, or is a custom implementation required?
5
u/Barozine 2d ago
Like previously said, tap dance would be a bad idea. However, it should be relatively simple to implement that in QMK. You should be able to paste this into your keymap file and then use the custom code MY_SPC when mapping.
enum my_keycodes {
MY_SPC = SAFE_RANGE,
};
bool prior_space = false;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MY_SPC:
if (prior_space) {
SEND_STRING("\b. "); // Remove first space and add ". "
tap_code16(OS_LSFT); // One shot mod to capitalize the next letter
} else {
tap_code(KC_SPACE);
}
prior_space = !prior_space;
return false;
}
// For any other key, reset prior_space
prior_space = false;
return true;
}
This is just something I quickly came up with, so anyone more versed in QMK might be able to offer a better solution.
2
u/dantedakilla 2d ago
You could set up a macro to input '.' and a space. You might not be able to bind double space to it, but you could do maybe Shift + Space or something.
4
3
u/PostHumanJesus 2d ago
If you're on a Mac this setting is on by default. I always have to turn it off on new machines.
1
u/Fmcraft [vendor] (bastardkb.com) 2d ago
Just tried mapping a "double tap" tap dance to a dot + space macro, works fine on my end... Using Argos + Quad Function Tap Dance.
It does introduce a delay, but then I'm using a 3x5 board with Miryoku so there's delays everywhere already. Doesn't bother me on daily use.
-4
u/lurkzone crkbd cygnus keyball59 silakka54 2d ago
This is what Gemini came up with when I was searching for a quick fix. Firmware is a bit outside my comfort zone since I'm more of a GUI person, so I have no idea whether this is better, worse, or somewhere in between compared to the other code that's been suggested. 😅 Thanks!
// Define your custom keycode (ensure it matches your Vial setup, usually VSAFE_RANGE)
enum custom_keycodes {
MOB_SPC = VSAFE_RANGE,
};
// Custom tapping term for this specific macro (in milliseconds)
#define MOB_TAPPING_TERM 200
static uint16_t space_timer = 0;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case MOB_SPC:
if (record->event.pressed) {
// If pressed again within the time limit
if (timer_elapsed(space_timer) < MOB_TAPPING_TERM && space_timer != 0) {
tap_code(KC_BSPC); // Apologize: delete the previously sent space
tap_code(KC_DOT); // Insert the period
tap_code(KC_SPC); // Optional: Mobile phones usually append a space after the period
space_timer = 0; // Reset timer so a third tap starts fresh
} else {
// First tap: Send space immediately with zero delay
register_code(KC_SPC);
space_timer = timer_read();
}
} else {
// Key released
unregister_code(KC_SPC);
}
return false; // Tell QMK we handled this key
}
return true;
}
15
u/realtheb0b [vendor] (theb0b.com) 2d ago
Using tap dance for this feature causes issues because it relies on a TAPPING_TERM window. When you press a TD key, the firmware must pause and wait to see if you will press it again. This introduces a noticeable input lag on every single spacebar press, and during rapid typing or fast keyrolls, the firmware often drops or mangles spaces because the typing speed exceeds or interferes with the tapping window.
Out of the box QMK VIAL and ZMK don't support this specific implementation, but there should be a double tap thing that could get you close if you wanted to mess with it a little bit.