-
-
Save trauner/5ab3d5bb58dcb068e5332720fe7ef739 to your computer and use it in GitHub Desktop.
KVM via USB Switch on Fedora 32
This file contains 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/zsh | |
usb_device="046d:c332" | |
display_output="HDMI-0" | |
while true | |
do | |
if lsusb | grep $usb_device > /dev/null 2>&1 | |
then | |
if xrandr --listactivemonitors | grep "Monitors: 0" > /dev/null 2>&1 | |
then | |
xrandr --output $display_output --auto | |
fi | |
else | |
if xrandr --listactivemonitors | grep "+*"$display_output > /dev/null 2>&1 | |
then | |
xrandr --output $display_output --off | |
fi | |
fi | |
sleep 1s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment