]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Center small screen in the middle of the physical screen
authorAdrian Lopez <adrianlzt@gmail.com>
Thu, 12 Oct 2017 12:51:15 +0000 (14:51 +0200)
committerAdrian Lopez <adrianlzt@gmail.com>
Thu, 12 Oct 2017 12:51:15 +0000 (14:51 +0200)
Also use transform instead of scale to fix error when scaling.

autorandr.py

index 7463b19f38c2225e6d4347e88c4cc174ad1d330e..44448e48e0ea4fe152cd327fb63dd3b855f1c22a 100755 (executable)
@@ -726,7 +726,9 @@ def generate_virtual_profile(configuration, modes, profile_name):
                 configuration[output].options["rate"] = mode["rate"]
                 configuration[output].options["pos"] = "0x0"
                 scale = max(float(biggest_resolution["width"]) / float(mode["width"]) ,float(biggest_resolution["height"]) / float(mode["height"]))
-                configuration[output].options["scale"] = "{}x{}".format(scale, scale)
+                mov_x = (float(mode["width"])*scale-float(biggest_resolution["width"]))/-2
+                mov_y = (float(mode["height"])*scale-float(biggest_resolution["height"]))/-2
+                configuration[output].options["transform"] = "{},0,{},0,{},{},0,0,1".format(scale, mov_x, scale, mov_y)
             else:
                 configuration[output].options["off"] = None
     return configuration