From 237f339f13111fcbda5e840c5d7c8e35c8c446ff Mon Sep 17 00:00:00 2001 From: Max Alexander Villa Date: Thu, 8 Dec 2022 17:30:18 -0800 Subject: [PATCH] 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. --- autorandr.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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): -- 2.39.2