Adds delete/backspace key. Resolves #93

This commit is contained in:
Kyle Brown 2019-03-09 15:12:23 -08:00
parent 1ad7602a9b
commit fc8ddba6cb
3 changed files with 25 additions and 0 deletions

View File

@ -193,6 +193,7 @@
|`KC.RESET` |Put the keyboard into DFU mode for flashing | |`KC.RESET` |Put the keyboard into DFU mode for flashing |
|`KC.DEBUG` |Toggle `debug_enabled`, which enables log spew to serial console | |`KC.DEBUG` |Toggle `debug_enabled`, which enables log spew to serial console |
|`KC.GESC` |Escape when tapped, <code>&#96;</code> when pressed with Shift or GUI| |`KC.GESC` |Escape when tapped, <code>&#96;</code> when pressed with Shift or GUI|
|`KC.BKDL` |Backspace when tapped, Delete when pressed with GUI |
|`KC.LEAD` |The [Leader key] | |`KC.LEAD` |The [Leader key] |
|`KC.UC_MODE_NOOP` |Sets UnicodeMode to NOOP | |`KC.UC_MODE_NOOP` |Sets UnicodeMode to NOOP |
|`KC.UC_MODE_LINUX` |Sets UnicodeMode to Linux | |`KC.UC_MODE_LINUX` |Sets UnicodeMode to Linux |

View File

@ -74,6 +74,29 @@ def gesc_released(key, state, KC, *args, **kwargs):
return state return state
def bkdl_pressed(key, state, KC, *args, **kwargs):
BKDL_TRIGGERS = {KC.LGUI, KC.RGUI}
if BKDL_TRIGGERS.intersection(state.keys_pressed):
state.config._send_hid()
state.keys_pressed.add(KC.DEL)
state.hid_pending = True
return state
# else return KC_ESC
state.keys_pressed.add(KC.BKSP)
state.hid_pending = True
return state
def bkdl_released(key, state, KC, *args, **kwargs):
state.keys_pressed.discard(KC.BKSP)
state.keys_pressed.discard(KC.DEL)
state.hid_pending = True
return state
def sleep_pressed(key, state, KC, *args, **kwargs): def sleep_pressed(key, state, KC, *args, **kwargs):
sleep_ms(key.meta.ms) sleep_ms(key.meta.ms)
return state return state

View File

@ -618,6 +618,7 @@ make_key(names=('BOOTLOADER',), on_press=handlers.bootloader)
make_key(names=('DEBUG', 'DBG'), on_press=handlers.debug_pressed, on_release=handlers.passthrough) make_key(names=('DEBUG', 'DBG'), on_press=handlers.debug_pressed, on_release=handlers.passthrough)
make_key(names=('GESC',), on_press=handlers.gesc_pressed, on_release=handlers.gesc_released) make_key(names=('GESC',), on_press=handlers.gesc_pressed, on_release=handlers.gesc_released)
make_key(names=('BKDL',), on_press=handlers.bkdl_pressed, on_release=handlers.bkdl_released)
make_key( make_key(
names=('LEADER', 'LEAD'), names=('LEADER', 'LEAD'),
on_press=handlers.leader_pressed, on_press=handlers.leader_pressed,