executable_monitor 1004 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env bash
  2. # This script allows controll monitor 34WN650-W
  3. # DDC/CI monitor control on Linux https://blog.tcharles.fr/ddc-ci-screen-control-on-linux/
  4. if [[ $UID != 0 ]]
  5. then
  6. echo "ddcutil requires root privileges."
  7. exit 1
  8. fi
  9. case "$1" in
  10. brightness)
  11. ddcutil setvcp --bus=11 10 "${1:-100}"
  12. ;;
  13. input)
  14. case "$2" in
  15. 1)
  16. # Config 1: Main PC
  17. OUT=("0x0f" "0x20")
  18. ;;
  19. 2|hdmi2|HDMI2)
  20. # Config 2: Virtual machine
  21. OUT=("0x11" "0x21")
  22. ;;
  23. *)
  24. echo "Unknown input '$1'"
  25. exit 1
  26. ;;
  27. esac
  28. ddcutil --bus=7 setvcp 60 ${OUT[0]}
  29. ddcutil --bus=11 setvcp 60 ${OUT[1]}
  30. ;;
  31. capabilities)
  32. (
  33. set -x
  34. ddcutil capabilities --bus=7
  35. ddcutil capabilities --bus=11
  36. )
  37. ;;
  38. *)
  39. ddcutil detect
  40. ;;
  41. esac