AirKeys
This is a small little program I wrote to solve a problem I was having in my living room. For a while I had my desktop PC hooked up behind my TV because my roommate and I were playing through Baldur's Gate 3 together. I didn't do much else with it so using my bluetooth mouse and some game controllers to navigate about Windows was just fine. But sometimes I would need a keyboard! And I didn't have a bluetooth keyboard! So instead of going out and buying a cheap keyboard or a long USB cable I decided to use some of the networking skills I was picking up in my classes.
AirKeys is a Python script that you can start up in "server mode" and it will sit idly waiting for a client. When an instance of AirKeys is started in "client mode", the two will discover each other using UDP broadcast messages, and the client will display a confirmation nonce (a la Apple TV) so the user knows they're connecting to the right server. Then a TCP stream is created between the two machines, and the magic can finally start. The client program will capture all keystrokes and send them swiftly over the network to the server, where it's emulating a keyboard, and emulates those same keystrokes. When I set this up using my laptop and desktop, it's as if my laptop is a bluetooth keyboard for my desktop. Neat!
The latency is actually very reasonable for navigating around the OS and I've even played games like Cyberpunk, Minecraft, and Space Engineers with almost no issues.
Now I know there are probably other programs out there that do this faster, more reliably, and with better security, but I don't really care. It's good enough for my use case and it's super rewarding to sit on the couch, forget that I'm even using anything other than a normal keyboard, and know that I created that for myself.
Check out the code here.
signpost care to venture further?
Side Projects
tylerthompson.work - the website you're currently looking at