This article focuses on how to gracefully switch between two computers and one monitor using a set of keyboards and mice. (two computers with one monitor)
Here’s a list of my devices:
- Two MAC
- A 27 “AOC display
- K8 keyboard made in Tokyo
- magic trackpad
Standards of elegance:
- At least you can’t plug and unplug the cable
- Keyboard shortcuts switch with one key
- Switching success rate 99%
Some conventions:
In this context, the same keyboard is used to switch between two computers
The switching miapad in the following section refers to the switching of the same Miapad between two computers
Elegance standards stage one
The first stage is to solve the switch process needs to plug and unplug the computer and monitor connection line, keyboard and mouse and computer connection line. This is just based on my equipment.
Device connection:
- The monitor and computer are connected with typeC and HDMI cables
- The keyboard and dashboard connect to the computer via Bluetooth
Hdmi cable Requires hdMI-TypeC cable to reach 4K 60Hz. The docking station on the market can only support 4K 30Hz
Switch the display input source
When we connect the monitor to two computers with two wires, we can switch the input source directly by pressing the physical key of the monitor. But is it elegant? It’s not elegant. After googling, I found a library DDCCTL that controls the display through the command line on the MAC platform. For detailed installation steps and environment requirements, please refer to the DDCCTL documentation.
After the installation, we can control the input source of the display from the command line:
DDCCTL -d 1 -i port DDCCTL -d 1 -i portCopy the code
Possible port numbers for common input sources:
For more information, see ddcctL-input Source. The port number of USB-C may be different for each monitor. For my AOC U27N3C, HDMI2 corresponds to 18, while USB-C corresponds to 15. The 27 in the table is measured in the Dell monitor. So using this library may require testing yourself to find the port number corresponding to your display input source.
After getting the port number corresponding to the input source, you can switch the input source of the display in the terminal. Well, that’s one step closer to using the keyboard to switch the input source of the monitor.
Up to now, our idea has been basically to press a shortcut key and execute a shell command. With the help of some keyboard mapping software, and then add some configuration to achieve, this article introduces a way to use MAC automatic operation to achieve the execution of shell commands after pressing the shortcut key:
Open the automatic operation, select New Document, and find the new run script on the left:
Drag to the right area, enter the command to switch display signal source, here enter the command to switch signal source to HDMI2: DDCCTL -d 1 -i 18, click run, test whether the switch is successful. If the following error occurs:
You need to add a line of code that reads as follows:
export PATH=/usr/local/bin:$PATH
ddcctl -d 1 -i 18
Copy the code
Command+S save the automatic action, then go to System Preferences -> Keyboard -> Shortcuts, services and find the name of the automatic action we defined, add the shortcut key.
At this point, the need to switch display input sources via the keyboard has been fulfilled.
I am two Macs, so as long as the above operations on both computers can be done, if some friends have Windows needs, you can refer to the keyboard control monitor input source switch in the Windows part.
To switch the keyboard
It supports both Bluetooth and wired connections, and bluetooth can connect up to three devices, so to meet the first stage of the elegant standard, you must choose Bluetooth connection.
Just pair the keyboard with two computers and switch between bluetooth connected devices using Fn+1 Fn+2 Fn+3. It’s very convenient.
Switch the control board
When I bought the mi pad, I thought it was possible to automatically switch between different devices with the same appleID, just like the AirPods.
I used AIrbuddy2, which has a nice UI. Its main function is to create a popover effect on the MAC like AirPods on the iPhone and iPad. It has a magic Handoff feature. You can switch some of Apple’s peripherals between multiple Macs.
Okay, 8 said it. It’s on the order
For details, see the official website tutorial. Here are some problems with this software when switching the control board:
- You cannot use shortcuts to transfer a peripheral to a computer
- If two devices do not log in to the same appleId, the bluetooth connection between two Macs may cause the Mi board to stall and the connection to be unstable.
- The transfer may fail
With that done, you’re basically at the top of the first stage of elegance. There is a problem: When we want to switch from one computer to another, we need to do the following in sequence:
- Switch the control board, dot, dot.
- Switch the display input source
- Switch the keyboard Bluetooth connection
The experience, to be honest, is a lot faster than plugging and unplugging without any mistakes.
Because one Of the Macs is connected to the monitor with the cover closed, it will occasionally fail to switch the monitor input source and switch the dashboard, and then it will be more troublesome
So in the second phase of the elegance standard we first need to do all three operations in one step, and then figure out how to improve the success rate
Elegance standard stage two
Oh, I didn’t do well either. It’s okay
Thought about using “I’ll show you” in “Automation” to do it
However, after the recording is finished, there is often an error in Airbuddy2, and I have not found a way to debug this thing, so I have to put it on hold, but I still think it is a feasible method.
Then I sent an email to the Support Center of Airbuddy2, hoping that they could add shortcut keys to the transfer peripherals. I haven’t received any reply yet. If shortcut keys can be added to the transfer Mouse control board, I feel that there will be more possibilities to achieve the second stage of elegance standard.
The third stage of elegance
As mentioned above, the experience of switching between display input sources and the dashboard occasionally fails, so you need a scheme that makes it almost impossible to fail.
Currently, the suspected reason for the failure is that one of the Macs is in the closed state (there is not enough room on the table, so the cover can only be closed).
In conclusion, for a set of keyboards and mice to switch between two computers and one monitor, only stage 1 of the elegance standard has been achieved so far. Stages 2 and 3 are more like my vision. Then if you also have this aspect of demand, it must first pick a good peripheral, seamless switching mainly by the hardware heap [DOGE].
Follow up the progress to update again, finally attached a desktop picture