|
|
|
|
|
by ranma42
1647 days ago
|
|
My shell-script solution I've been using for the last year or two: #!/bin/bash
src="pc"
while true; do
lsusb -d 04d9:a0d1 >/dev/null # Keyboard connected?
ret=$?
if [ $ret -eq 0 -a "$src" != "pc" ]; then
src="pc"
ddcutil --noverify setvcp 60 0x0f # Switch monitor input to DP
elif [ $ret -eq 1 -a "$src" = "pc" ]; then
src="laptop"
ddcutil --noverify setvcp 60 0x11 # Switch monitor input to HDMI
fi
sleep 1
done
|
|
One second latency ... not ideal.
Is there any way to sleepwait on a USB config change instead?
[EDIT]: this might help:
https://stackoverflow.com/questions/469243/how-can-i-listen-...