Files
configs/bin/screens
arnaucube 55b362f88f update nixos configs
- bin/screens: line to fix touchscreen rotation
- add zathura config file (zathurarc)
- nixos:
  - rearrange config files reusing most of configs in common-configuration.nix
  - add chuwi-configuration.nix
2025-01-25 19:27:36 +01:00

50 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import os
import subprocess
import sys
print(sys.argv[1])
setup = sys.argv[1]
subprocess.run(["xrandr", "--auto"])
d = os.popen("xrandr --listmonitors | grep '+' | awk {'print $4'}").read().splitlines()
print(d[1])
pos = "--above"
if setup == "h":
pos="--right-of"
elif setup == "ih":
pos="--left-of"
elif setup == "v":
pos="--above"
elif setup=="mirror":
pos="--same-as"
subprocess.run(["xrandr", "--output", d[1], pos, "eDP-1"])
if len(sys.argv)>2:
if sys.argv[2] == "4k":
print("4k")
# xrandr --output HDMI-2 --mode 3840x2160
subprocess.run(["xrandr", "--output", d[1], "--mode", "3840x2160"])
# restart i3 status bar to avoid being frozen
subprocess.run(["i3-msg", "restart"])
# for fixing touch screen
# Check the input device ID with `xinput`.
# Check the display device name with `xrandr`.
#
# `xinput map-to-output <ID> <NAME>`
# eg. xinput map-to-output 12 eDP-1
#
# to rotate (90 degrees to right) the input of the touchscreen:
# `xinput set-prop 'pointer:Goodix Capacitive TouchScreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1`