Introduction
Sometimes you just need a simple way to send a keypress from one computer to another over your local network. Full remote desktop solutions (RDP, VNC, TeamViewer) are overkill when all you want is: “press a key on one machine → OBS on the streaming PC reacts as if the key was pressed locally”.
That’s exactly what this little Python tool does.
It consists of two scripts:
client_keypress.py
→ runs on a remote computer, listens for a specific key and transmits its state (“pressed” / “released”) over the network.server_keypress.py
→ runs on the target PC, receives the key state and emulates a real keyboard event so that OBS (or any software) can register it as a hotkey.
This allows you to, for example, hold Right Ctrl on one computer and have it act like F13 on your streaming PC, which you can then bind in OBS as a hotkey.
Download
How it Works
- The client script uses the keyboard library to globally detect when you press or release a certain key (e.g. Right Ctrl).
- It continuously sends small UDP packets to the server with the key state.
- The server script listens for these packets, filters them, and uses the same
keyboard
library to simulate actual key presses/releases. - From OBS’ perspective, it’s as if you pressed a real key on a local keyboard.
Because the communication is based on heartbeats and timeouts, the key will never get “stuck” if a packet is lost.
Features
- 🔑 While-pressed events → the key remains held down on the server until you release it on the client.
- 🎮 OBS integration → map the remote key to any OBS hotkey (e.g. scene switch, source toggle).
- 🔒 Secret + IP filter → only packets with the correct secret (e.g.
OBS1
) and optionally from a specific IP are accepted. - 🛡 Failsafe timeout → if communication stops, the server automatically releases the key.
- ⚡ Low latency → ~50 ms heartbeat, almost instant reaction.
Requirements
- Python 3.x on both machines
keyboard
library → install with:pip install keyboard
- On Windows: run scripts as Administrator (otherwise key hooks and injections won’t work).
Setup
On the Server (Streaming PC)
- Edit
server_keypress.py
and set:PORT = 45987 VIRTUAL_KEY = "f13" # the key OBS will see SECRET = "OBS1" ALLOWED_CLIENT_IP = "192.168.2.161" # your remote computer’s IP (optional)
- Run the script as Administrator:
python server_keypress.py
- In OBS → Settings → Hotkeys, bind your action (e.g. “Switch to Scene 2”) to F13.
On the Remote Computer
- Edit
client_keypress.py
and set:SERVER_IP = "192.168.2.100" # IP of your streaming PC SERVER_PORT = 45987 SECRET = "OBS1" LOCAL_KEY = "strg-rechts" # or "right ctrl" depending on your layout
- Run the script as Administrator:
python client_keypress.py
- Hold the chosen key (e.g. Right Ctrl). OBS on the server reacts instantly as if you pressed F13 locally.
Example Use Case
Imagine you’re performing or presenting with two machines:
- 🎛 A remote computer in front of you
- 🖥 A dedicated streaming PC running OBS in the background
You want to hold a key on the remote machine to trigger a special effect, switch a camera, or mute/unmute a source in OBS. Instead of buying a Stream Deck, this script turns any key into a remote trigger.
Security Notes
- Always set a secret string so random LAN noise is ignored.
- Use a dedicated port (e.g. 45987).
- Optionally restrict to your remote computer’s IP address.
- Packets are plain UDP, so don’t expose this directly to the internet without tunneling (e.g. VPN).
Conclusion
With client_keypress.py
and server_keypress.py
, you now have a minimal but powerful way to send a single key (or multiple keys) across the network. OBS, games, or any desktop application will see them as local input.
It’s lightweight, extensible, and a fun DIY alternative to commercial hardware buttons.