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.

47 lines
969 B

3 months ago
  1. #!/usr/bin/env python3
  2. import os
  3. import subprocess
  4. import sys
  5. print(sys.argv[1])
  6. setup = sys.argv[1]
  7. subprocess.run(["xrandr", "--auto"])
  8. d = os.popen("xrandr --listmonitors | grep '+' | awk {'print $4'}").read().splitlines()
  9. print(d[1])
  10. pos = "--above"
  11. if setup == "h":
  12. pos="--right-of"
  13. elif setup == "ih":
  14. pos="--left-of"
  15. elif setup == "v":
  16. pos="--above"
  17. elif setup=="mirror":
  18. pos="--same-as"
  19. subprocess.run(["xrandr", "--output", d[1], pos, "eDP-1"])
  20. if len(sys.argv)>2:
  21. if sys.argv[2] == "4k":
  22. print("4k")
  23. # xrandr --output HDMI-2 --mode 3840x2160
  24. subprocess.run(["xrandr", "--output", d[1], "--mode", "3840x2160"])
  25. # restart i3 status bar to avoid being frozen
  26. subprocess.run(["i3-msg", "restart"])
  27. # for fixing touch screen
  28. # Check the input device ID with `xinput`.
  29. # Check the display device name with `xrandr`.
  30. # `xinput map-to-output <ID> <NAME>`
  31. # eg. xinput map-to-output 12 eDP-1