tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
2.99k stars 250 forks source link

Port text to HID keystroke logic #1624

Closed jdeanwallace closed 11 months ago

jdeanwallace commented 11 months ago

Related https://github.com/tiny-pilot/tinypilot/issues/1026

This PR ports TinyPilot's "paste" functionality from the fontend to the backend, by parsing the pasted text into HID keystrokes on the server.

This PR copies the functionality of the following JS files to Python files, without modifying any existing code:

Notes

  1. I've changed the way that we determine if a text character (e.g., A) requires a key modifier (e.g., left shift) when being typed on a keyboard. Instead of all keyboard languages matching against a single regex, we now map a text character on a specific language keyboard directly to a HID keystroke. This should allow us to avoid ambiguity between keyboard languages and support more text characters.

Peer testing

You can test this PR on device via the following stacked PR:

Review on CodeApprove

jdeanwallace commented 11 months ago
Automated comment from CodeApprove ➜

⏳ @jotaen4tinypilot please review this Pull Request