Last active
September 21, 2020 15:51
-
-
Save 56quarters/3f82bc03761670e14d05d12af7175250 to your computer and use it in GitHub Desktop.
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
# Switch the input of the monitor when we detect the logitech mouse is removed | |
ACTION=="remove", ENV{ID_MODEL}=="Gaming_Mouse_G402", RUN+="/usr/local/bin/ddc-display.sh 1" |
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
# Switch the input of the monitor when we detect the logitech mouse is removed | |
ACTION=="remove", ENV{ID_MODEL}=="Gaming_Mouse_G402", RUN+="/usr/local/bin/ddc-display.sh 2" |
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
#!/bin/sh | |
# Set the input for the monitor using ddcutil. Requires that the user is | |
# in the i2c group. Input 1 for the gaming pc, 2 for the laptop dock. | |
main() { | |
case "$1" in | |
1 ) | |
# Display port (gaming PC) | |
INPUT="0x0f" | |
;; | |
2 ) | |
# Mini display port (laptop dock) | |
INPUT="0x10" | |
;; | |
* ) | |
echo "Unknown display $1" | |
return 1 | |
;; | |
esac | |
# 60 is the "change input" feature | |
ddcutil --bus=5 setvcp 60 "$INPUT" | |
return 0 | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment