Last active
September 5, 2022 19:34
-
-
Save andli/87847b6dc86b2023c2c650eb88058030 to your computer and use it in GitHub Desktop.
Toggle input source of Dell U2715H (or other i2c enabled monitors) from keyboard shortcut
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
#!/bin/bash | |
#sudo cp toggleinput.sh /usr/local/bin/toggleinput | |
#chmod 755 | |
#chown root:root | |
#set as keyboard shotcut target | |
#elevate to root if necessary | |
if test "$(id -u)" -ne 0 ; then | |
sudo "$0" "$1" | |
exit $? | |
fi | |
#probe input menu over i2c | |
inputid=$(ddccontrol -r 0x60 dev:/dev/i2c-0 | tail -1 | cut -d'/' -f 2) | |
echo "Input is "$inputid | |
if test $inputid -ne 15 ; then | |
ddccontrol -r 0x60 -w 15 dev:/dev/i2c-0 #mDP | |
exit 1 | |
else | |
ddccontrol -r 0x60 -w 17 dev:/dev/i2c-0 #hdmi1 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment