From: Max Alexander Villa Date: Fri, 9 Dec 2022 01:30:18 +0000 (-0800) Subject: Add reverse versions of horizontal/vertical virtual profiles X-Git-Tag: 1.13~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=sidebyside;h=237f339f13111fcbda5e840c5d7c8e35c8c446ff;p=deb_pkgs%2Fautorandr.git Add reverse versions of horizontal/vertical virtual profiles Add "vertical-reverse" and "horizontal-reverse" to virtual profiles dictionary and use reversed() iter of configuration dictionary if user selects these. --- diff --git a/autorandr.py b/autorandr.py index 431069a..a23d1a6 100755 --- a/autorandr.py +++ b/autorandr.py @@ -68,6 +68,8 @@ virtual_profiles = [ ("clone-largest", "Clone all connected outputs with the largest resolution (scaled down if necessary)", None), ("horizontal", "Stack all connected outputs horizontally at their largest resolution", None), ("vertical", "Stack all connected outputs vertically at their largest resolution", None), + ("horizontal-reverse", "Stack all connected outputs horizontally at their largest resolution in reverse order", None), + ("vertical-reverse", "Stack all connected outputs vertically at their largest resolution in reverse order", None), ] properties = [ @@ -1050,7 +1052,7 @@ def generate_virtual_profile(configuration, modes, profile_name): configuration[output].options["pos"] = "0x0" else: configuration[output].options["off"] = None - elif profile_name in ("horizontal", "vertical"): + elif profile_name in ("horizontal", "vertical", "horizontal-reverse", "vertical-reverse"): shift = 0 if profile_name == "horizontal": shift_index = "width" @@ -1058,8 +1060,10 @@ def generate_virtual_profile(configuration, modes, profile_name): else: shift_index = "height" pos_specifier = "0x%s" - - for output in configuration: + + config_iter = reversed(configuration) if "reverse" in profile_name else iter(configuration) + + for output in config_iter: configuration[output].options = {} if output in modes and configuration[output].edid: def key(a):