How do you detect keystrokes? - FYI

I am proposing an extension that detects onscreen keyboard and bluetooth or USB keyboard inputs. This means that I could hit "Ctrl+T" and the extension would detect it if I have a keyboard connected using USB or Bluetooth, or maybe a device with a built in keyboard as well. I am not sure how do-able this is but I think it is probably pretty simple. IDK, if this extension is already made then please tell me about it! if anybody has some free time I would greatly appreciate if you could build a test version, but if not I totally understand and I will try to code it as well. But I have never built an extension before, so it might be janky.

Android should automatically detect an external keyboard...

It does with my bluetooth keyboard, and with genymotion (but I believe this might be a parent OS thing)

1 Like

How can I detect what keys are being pressed without having to write in a text box? :smile: sorry for not being more clear

You want a keylogger? Hmmm, dangerous :wink:

Make a textbox hidden (or at least tiny, e.g. 1x1 pixels), then give it focus, then type.

That is a great idea, yet I want to use this in function with a webviewer. Yet I will test out this idea and see if it works. I forgot how dangerous a keylogger can be: but I think this will work. I will come back and report if it works or not with modifier keys like CTRL, Enter, Shift, ect.

Ctrl does not work, I think Enter is possible by using /n or \n and Shift works. Here is some code that I used for it to work.

image

I created a horizontal arrangement that has a size of 3px in every direction, then I placed the text box inside. Thanks for the help!

The print block is just a block that changes a label on the side of the screen, this is just to see if this works