From: Adrian Lopez <adrianlzt@gmail.com>
Date: Thu, 12 Oct 2017 12:24:09 +0000 (+0200)
Subject: Respect aspect ratio
X-Git-Tag: 1.2~5
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0b100b0ecdcdb0f161e67eb23e4af4f47243c1cb;p=deb_pkgs%2Fautorandr.git

Respect aspect ratio
---

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