Scripts and desktop files to switch the input of my Samsung (which automatically switches the USB hub as well). This way I can switch to the other computer by just clicking a button.
Created
September 30, 2026 09:53
-
-
Save floitsch/77cd90b8c46eb9deb2b7b46fba657c30 to your computer and use it in GitHub Desktop.
Switch Samsung monitor input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Desktop Entry] | |
| Type=Application | |
| Name=Switch Monitor to HDMI | |
| GenericName=Monitor Input Switcher | |
| Comment=Switch the Samsung monitor to HDMI | |
| Icon=video-display | |
| Exec=/home/floitsch/Desktop/switch-monitor-input.sh hdmi | |
| Terminal=false | |
| StartupNotify=false | |
| Categories=Utility; | |
| Actions=HDMI;DisplayPort;USBC; | |
| [Desktop Action HDMI] | |
| Name=Switch to HDMI | |
| Icon=video-display | |
| Exec=/home/floitsch/Desktop/switch-monitor-input.sh hdmi | |
| [Desktop Action DisplayPort] | |
| Name=Switch to DisplayPort | |
| Icon=video-display | |
| Exec=/home/floitsch/Desktop/switch-monitor-input.sh dp | |
| [Desktop Action USBC] | |
| Name=Switch to USB-C | |
| Icon=video-display | |
| Exec=/home/floitsch/Desktop/switch-monitor-input.sh usb-c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Desktop Entry] | |
| Type=Application | |
| Name=Switch Monitor to HDMI | |
| GenericName=Monitor Input Switcher | |
| Comment=Switch the Samsung monitor to HDMI | |
| Icon=video-display | |
| Exec=/home/floitsch/Desktop/switch-monitor-input.sh usb-c | |
| Terminal=false | |
| StartupNotify=false | |
| Categories=Utility; | |
| Actions=HDMI;DisplayPort;USBC; | |
| [Desktop Action HDMI] | |
| Name=Switch to HDMI | |
| Icon=video-display | |
| Exec=/home/floitsch/Desktop/switch-monitor-input.sh hdmi | |
| [Desktop Action DisplayPort] | |
| Name=Switch to DisplayPort | |
| Icon=video-display | |
| Exec=/home/floitsch/Desktop/switch-monitor-input.sh dp | |
| [Desktop Action USBC] | |
| Name=Switch to USB-C | |
| Icon=video-display | |
| Exec=/home/floitsch/Desktop/switch-monitor-input.sh usb-c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| input="${1:-hdmi}" | |
| case "${input,,}" in | |
| hdmi) | |
| code=0x11 | |
| ;; | |
| dp|displayport) | |
| code=0x0F | |
| ;; | |
| usb|usb-c|usbc) | |
| code=0x36 | |
| ;; | |
| *) | |
| echo "Usage: $(basename "$0") [hdmi|dp|usb-c]" >&2 | |
| exit 2 | |
| ;; | |
| esac | |
| ddcutil --display 1 setvcp 60 "$code" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment