arnaucube
arnaucube/configsPublic Self-hosted repository
configs/bin/screens
bin/screensRaw
 1#!/usr/bin/env python3
 2
 3import os
 4import subprocess
 5import sys
 6
 7print(sys.argv[1])
 8
 9setup = sys.argv[1]
10
11subprocess.run(["xrandr", "--auto"])
12
13d = os.popen("xrandr --listmonitors | grep '+' | awk {'print $4'}").read().splitlines()
14print(d[1])
15
16pos = "--above"
17if setup == "h":
18    pos="--right-of"
19elif setup == "ih":
20    pos="--left-of"
21elif setup == "v":
22    pos="--above"
23elif setup=="mirror":
24    pos="--same-as"
25
26subprocess.run(["xrandr", "--output", d[1], pos, "eDP-1"])
27
28if len(sys.argv)>2:
29    if sys.argv[2] == "4k":
30        print("4k")
31        # xrandr --output HDMI-2 --mode 3840x2160
32        subprocess.run(["xrandr", "--output", d[1], "--mode", "3840x2160"])
33
34        # restart i3 status bar to avoid being frozen
35        subprocess.run(["i3-msg", "restart"])
36