You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 rivejä
650 B

  1. #!/usr/bin/env bash
  2. MON=1 # Primary monitor
  3. DP="0x0f"
  4. HDMI1="0x11"
  5. HDMI2="0x12"
  6. ###
  7. CURR_INPUT=""
  8. function toggle {
  9. get_input
  10. if [[ ${CURR_INPUT} == ${DP} ]]; then
  11. set_input ${HDMI1}
  12. elif [[ ${CURR_INPUT} == ${HDMI1} ]]; then
  13. set_input ${DP}
  14. fi
  15. }
  16. function set_input {
  17. ddcutil setvcp -d ${MON} 60 ${1}
  18. }
  19. function get_input {
  20. CURR_INPUT="0$(ddcutil getvcp -d ${MON} 60 -t | cut -d' ' -f4)"
  21. }
  22. if [ $@ ]; then
  23. for arg in "$@"; do
  24. shift;
  25. case $arg in
  26. "--dp") set_input ${DP} ;;
  27. "--hdmi1") set_input ${HDMI1} ;;
  28. "--hdmi2") set_input ${HDMI2} ;;
  29. "-h") echo "Usage: $0 [--dp|--hdmi1|--hdmi2]" ;;
  30. esac
  31. done
  32. else
  33. toggle
  34. fi