tmk / tmk_keyboard

Keyboard firmwares for Atmel AVR and Cortex-M
4k stars 1.71k forks source link

Possible to have a layer-switching key convert to Alt when necessary? #731

Closed drelephant closed 2 years ago

drelephant commented 2 years ago

If this is not the correct place to ask questions, then please let me know where to ask.

I have an Ergodox running TMK that works great.

I have a key that I hold down to activate a movement layer that has arrows, PGUP, PGDN, etc. ACTION_LAYER_MOMENTARY(6).

I would like to also have keys on that layer to send Alt-Tab and Alt-Shift-Tab to switch between Apps on Windows.

So I would like the same key that I hold down to activate the movement layer, to send Alt, but only when I press certain keys on the movement layer.

Also it should only release the Alt key when I let go of the layer-switching key.

Is this possible using TMK?

drelephant commented 2 years ago

I worked it out, basically using this QMK commit, although I had to change it to use action functions instead of process_record_user, and register_code() then immediately unregister_code() instead of tap_code().