This commit is contained in:
Roberto Alsina 2020-01-31 21:10:24 -03:00
parent c7e7267cb6
commit 03cfa7e136

14
main.py
View File

@ -21,7 +21,9 @@ def gen_xrandr_from_data(data):
if mon["orientation"] in (1, 3):
mod_x, mod_y = mod_y, mod_x
cli.append(f'--scale {mon["res_x"]/mod_x}x{mon["res_y"]/mod_y}')
cli.append(f"--rotate {['normal', 'left', 'inverted', 'right'][mon['orientation']]}")
cli.append(
f"--rotate {['normal', 'left', 'inverted', 'right'][mon['orientation']]}"
)
if mon["primary"]:
cli.append("--primary")
if not mon["enabled"]:
@ -43,13 +45,13 @@ def parse_monitor(line):
enabled = False
res_x = res_y = pos_x = pos_y = w_in_mm = h_in_mm = 0
left_side = line.split(' (normal left inverted ')[0]
left_side = line.split(" (normal left inverted ")[0]
orientation = 0
if 'left' in left_side:
if "left" in left_side:
orientation = 1
elif 'inverted' in left_side:
elif "inverted" in left_side:
orientation = 2
elif 'right' in left_side:
elif "right" in left_side:
orientation = 3
return (
@ -84,7 +86,7 @@ class Window(QObject):
super().__init__()
self.ui = ui
ui.show()
self.ui.setWindowTitle('Display Configuration')
self.ui.setWindowTitle("Display Configuration")
self.ui.screenCombo.currentTextChanged.connect(self.monitor_selected)
self.ui.orientationCombo.currentIndexChanged.connect(self.orientation_changed)
self.xrandr_info = {}