An example of an HTTP server that switches screen inputs by calling a DDC utility.
IMG_2850.mov
It's difficult or cumbersome to switch inputs using the controls on the monitors. An example might be where you have a multi-monitor setup and want to quickly and easily switch between a Mac and another computer.
A web server runs on one of the machines with an interface allowing you to select a computer. This script is a really basic example of how this could be accomplished.
It could be adapted to work on any operating system, but in this case it expects the server to run on an M1 Mac.
- Install m1ddc (Homebrew makes it easy) if using an Apple Silicon Mac as the server.
- Python 3 is required, and Flask should be installed by running
pip install -r requirements.txt
in the repo root.
- The
switch_to_mac.sh
andswitch_to_pc.sh
shell scripts need to be updated to the appropriate number of displays and the input values.- If running on a machine that's not macOS or not Apple Silicon, this is where you'd substitute the
m1ddc
utility with something else. - If using
m1ddc
:- See Commands section
- Keep in mind that this utility expects addresses to be decimal, not hex.
- If running on a machine that's not macOS or not Apple Silicon, this is where you'd substitute the
switcher.py
- Update or remove the
filter_ips()
hook. - Optionally update the port (defaults to 9000).
- Update or remove the
python3 switcher.py
- Load the utility in a browser:
http://hostname:9000