SDI provides a simple way to switch a display's input source (HDMI / DP / VGA / DVI) using DDC/CI.
The main script, switch_display_input.sh, uses a mapping file that contains display names and their I²C bus IDs.
A helper script, extract_bus.sh, generates this mapping file automatically.
- Installed
ddcutil - Give execution permission to both scripts:
chmod +x switch_display_input.sh
chmod +x extract_bus.sh./switch_display_input.sh <input> [display_name]Switch the first display in the mapping file to HDMI 1:
./switch_display_input.sh hdmi1Switch a specific display to DisplayPort 1:
./switch_display_input.sh dp1 OMEN_27q| Argument | Description |
|---|---|
1, hdmi1 |
HDMI 1 |
2, hdmi2 |
HDMI 2 |
dp, dp1 |
DisplayPort 1 |
dp2 |
DisplayPort 2 |
vga, vga1 |
VGA 1 |
dvi, dvi1 |
DVI 1 |
- If no display name is provided, the script uses the first entry in the mapping file.
- If a display name is provided but not found, the script returns an error.
You can manually generate or refresh the display bus mapping file using:
./extract_bus.shThis script scans all connected displays and writes their names and bus IDs into monitors_bus_ids.txt.
switch_display_input.sh will automatically attempt to run it if the file is missing.