RemoteWebViewServer icon indicating copy to clipboard operation
RemoteWebViewServer copied to clipboard

On-screen keyboard via Javascript injection at the Chrome DevTools Protocol level

Open SleepinDevil opened this issue 9 months ago • 4 comments

Hey @strange-v amazing work on this project by the way. I absolutely love it and have fallen in love with it. If you had a donation link I would have given you some $$ for a few coffees!

I have created an on-screen keyboard by injecting Javascript at the CDP level. The JS code itself is pretty simple, the toughest part in this was to navigate through all the HA Lit frontend objects and weirdness that normal < input > and < textarea > type elements do not have.

As of today I have a fully working keyboard for Latin/English character set which works pretty well in my own testing. My use case for this has been being able to easily login to HA as a first time user, but then also being able to do some basic edits on the screen - I am lazy to pull out my phone sometimes 😅.

My fork is here - https://github.com/SleepinDevil/RemoteWebViewServer

This has been tested with a 480x480 display only and I don't know how the keyboard will behave in smaller resolutions. It should work fine in larger resolutions though.

I made it so it's possible for other people to modify the JS themselves and have provided the non-minified option for them to play with as well. The end user has effectively 4 layout pages they can play with to add character symbols they want from their own local language sets.

Just leaving this here in case it interested anyone else 👍.

I'm happy to add in an environment variable and create a pull request if you think it's worthwhile 🙂.

SleepinDevil avatar Mar 06 '26 13:03 SleepinDevil

It looks solid. Does the keyboard work only in HA, or on any web page? The URL update from the server is a nice feature, it was planned but never implemented.

I’ll take a closer look when I have more free time.

P.S. I don’t accept personal donations, but I’d appreciate it if you donated via the Help Ukraine banner in the repo (my recommendation is Come Back Alive).

strange-v avatar Mar 13 '26 06:03 strange-v

I've created a Pull Request on your Server and Client projects pushing through updates that I've done and been using successfully on my end.

Please let me know if you have any questions about it, and please don't feel like you have to accommodate the pull requests - I am just having a bit of fun with all of it.

I've also just now ordered one of the new Waveshare ESP32-P4 4" 720x720 "86" displays. Super eager to get your project running on one of those, going to be playing around with the hardware JPEG encoder in that to see if we can get the Server and Client running blazing fast on the ESP32-P4. I think your project opens up so many doors and is far superior to doing something with LVGL!

SleepinDevil avatar Mar 13 '26 12:03 SleepinDevil

@strange-v I realised I didn't answer your question 😅

Yes the keyboard works on any website theoretically. I've tried it on Wikipedia, Archive.org and Google specifically and it works on those fine.

Getting it working on HA was a bit trickier than other websites because HA Frontend being the LIT Framework, I had to dig a bit deeper into the custom HTML elements HA creates for the input boxes and hook event listeners in a way that it works there. But the current version works pretty well.

We probably will need to see if there's any other updates or bug fixes needed for the keyboard with the event listeners on the HTML side though - there could be edge cases I haven't noticed in my testing yet. This is why I've provided the full unminified code to allow for testing fixes easier.

In my testing though, clicking into an element that is Text editable does 100% of the time make the keyboard visible, if others find this is not the case, then I'm happy to troubleshoot and get it working.

SleepinDevil avatar Mar 13 '26 21:03 SleepinDevil

@SleepinDevil, as you may have seen, I finally got around to merging your PRs. The keyboard underwent the biggest changes — I wasn’t very comfortable keeping its code in this repo, so I opted for an external script injection approach (I explained the reasoning in the PR).

If you create a separate repo for the keyboard with the code and some screenshots, I’ll add a link to it in the RWV documentation. That way, other users can link directly to the GitHub script and use it (although my inner paranoid says it’s safer to always host the file locally on your own server).

Thanks again for the contribution!

strange-v avatar Apr 25 '26 12:04 strange-v