From 58f72858d91c52aa6acaed6a6648209a61e76f66 Mon Sep 17 00:00:00 2001 From: Adrian Lopez Date: Thu, 12 Oct 2017 14:51:15 +0200 Subject: [PATCH] Center small screen in the middle of the physical screen Also use transform instead of scale to fix error when scaling. --- autorandr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.39.2