Detecting text fields

Hi everyone,

I just started programming with Arduino, some Projects are already working.
But now I need some help, there is no useful information on the internet.
The hardware-part is easy, I want to build a keyboard light.
A few LEDs connected to an arduino, which is plugged into a usb port.
But I dont want to make one of those always-on lights.
It should only light up if you need it.
There must be a way to detect a blinking cursor in a text field.
For exampe in a browser when you are typing something in the searchbar.
In Android or iOS the keybard pops up if you click on a text field.
The same thing should be possible in Windows.
But I dont have any idea how to start with this.

Thanks in advance,
Max

Just to confirm, you want to check when any text input area on any application gets focus?

That's pretty low level. You'd need to hook into the system-wide text input processes.

Yes, that is exactly what I want it to do.
And it cant be that complicated, the program does not have to search for text fields.
It should just detect if the cursor is in text mode.
Like when you clicked on a text field in a browser the arrow keys control the cursor,
They dont move the page up and down anymore.

And it cant be that complicated

Really? Off you go then.

This is window manager level function. It is the window manager's job to control (amongst other things) input functionality. You will need to find a way to hook into the window manager (Explorer.exe in MS Windows), and get it to notify a routine that you will need to write. That routine will then need to send something to your Arduino. There are, I believe, interrupt hooks that are used by the international language/keyboards processes when text input fields get focus. You might be able to attach to that process somehow, but this is not trivial, and requires fairly low level knowledge of Windows internals.

Wow.
Looks like I wont get around using a on/off switch.
Would it be easier to use the function in Google Chrome only?

Possibly. Chrome's extensions API can notify an extension whenever a text input field gets focus.

Whether a Chrome extension can communicate with an Arduino is another question, and I don't know the answer to that.

OK, thanks.
Now I know what to search for.
At least it is possible.