Keybow2040 - send multiple keycodes in response to a single actual keypress?

Hi all,

Recently got hold of a keybow2040 which I’m having a lot of fun with. What I’d like to do it be able to send multiple keys in response to a single key press (for example I press a single key on the keybow and it sends ALT+F4).

I put this code together -

combo_1 = [Keycode.ALT,Keycode.F4]
for k in combo_1:
keyboard.send(k)

However that has the the effect of sending the ALT keycode followed by the F4 keycode - not at the same time.

I’ve seen the docs on GitHub - pimoroni/keybow2040-circuitpython: CircuitPython library for the Pimoroni Keybow 2040 which documents key modifiers but that relates to multiple keypresses on the keybow to send a single keystroke.

Any ideas if its even possible?!

Thanks!

Something like this is I think what your after.

require "keybow"

function handle_key_00(pressed)
    if pressed then
        keybow.set_modifier(keybow.LEFT_META, keybow.KEY_DOWN)
        keybow.tap_key("r", pressed)
        keybow.set_modifier(keybow.LEFT_META, keybow.KEY_UP)
    end
end

https://learn.pimoroni.com/tutorial/sandyj/using-macros-and-snippets-with-keybow

Thanks for the swift response. Thats an example for the keybow hardware and I’m using the keybow2040. I dont believe the code is cross compatible as thats written in lua and I believe the keybow2040 can only use CircuitPython.

Ah, OK, missed that, ops.

Well I’ve figured it out! Its pretty simple :D

If I want to send ALT and F4 (at the same time) in response to the 10th key on the keyboard being pressed:

    if key.number == 9:
        keyboard.send(Keycode.ALT, Keycode.F4)

Can’t believe I didnt try that a few days ago!

1 Like

That could come in handy for me, thanks for posting the solution. I have the PICO RGB Keypad base, and have it running a port of Keybow 2040 Circuit Python. I have plans for multi key on button press code.

1 Like

How would this work inside a layer definition? I have tried the multiple keycodes against a button definition in a layer but i can’t get it to work