From 0b100b0ecdcdb0f161e67eb23e4af4f47243c1cb Mon Sep 17 00:00:00 2001 From: Adrian Lopez Date: Thu, 12 Oct 2017 14:24:09 +0200 Subject: [PATCH] Respect aspect ratio --- autorandr.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autorandr.py b/autorandr.py index 8aadacd..7463b19 100755 --- a/autorandr.py +++ b/autorandr.py @@ -725,9 +725,8 @@ def generate_virtual_profile(configuration, modes, profile_name): configuration[output].options["mode"] = mode["name"] configuration[output].options["rate"] = mode["rate"] configuration[output].options["pos"] = "0x0" - x_scale = float(biggest_resolution["width"]) / float(mode["width"]) - y_scale = float(biggest_resolution["height"]) / float(mode["height"]) - configuration[output].options["scale"] = "{}x{}".format(x_scale, y_scale) + scale = max(float(biggest_resolution["width"]) / float(mode["width"]) ,float(biggest_resolution["height"]) / float(mode["height"])) + configuration[output].options["scale"] = "{}x{}".format(scale, scale) else: configuration[output].options["off"] = None return configuration -- 2.39.2