From: Adrian Lopez Date: Thu, 12 Oct 2017 12:51:15 +0000 (+0200) Subject: Center small screen in the middle of the physical screen X-Git-Tag: 1.2~4 X-Git-Url: https://git.donarmstrong.com/?p=deb_pkgs%2Fautorandr.git;a=commitdiff_plain;h=58f72858d91c52aa6acaed6a6648209a61e76f66 Center small screen in the middle of the physical screen Also use transform instead of scale to fix error when scaling. --- diff --git a/autorandr.py b/autorandr.py index 7463b19..44448e4 100755 --- a/autorandr.py +++ b/autorandr.py @@ -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