]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blobdiff - autorandr.py
Explain why we enable outputs in pairs of two
[deb_pkgs/autorandr.git] / autorandr.py
index 64e9e22c7dc5315993c20abe69772cbe00b9318f..b288e41f914b9ed97e81e176fbb2ac105d9740d8 100755 (executable)
@@ -145,12 +145,12 @@ class XrandrOutput(object):
     @property
     def option_vector(self):
         "Return the command line parameters for XRandR for this instance"
-        return sum([["--%s" % option[0], option[1]] if option[1] else ["--%s" % option[0]] for option in chain((("output", self.output),), self.options_with_defaults.items())], [])
+        return sum([["--%s" % option[0], option[1]] if option[1] else ["--%s" % option[0]] for option in chain((("output", self.output),), sorted(self.options_with_defaults.items()))], [])
 
     @property
     def option_string(self):
         "Return the command line parameters in the configuration file format"
-        return "\n".join([ " ".join(option) if option[1] else option[0] for option in chain((("output", self.output),), self.options.items())])
+        return "\n".join([ " ".join(option) if option[1] else option[0] for option in chain((("output", self.output),), sorted(self.options.items()))])
 
     @property
     def sort_key(self):
@@ -328,6 +328,8 @@ def parse_xrandr_output():
 
     # Split at output boundaries and instanciate an XrandrOutput per output
     split_xrandr_output = re.split("(?m)^([^ ]+ (?:(?:dis)?connected|unknown connection).*)$", xrandr_output)
+    if len(split_xrandr_output) < 2:
+        raise RuntimeError("No output boundaries found")
     outputs = OrderedDict()
     modes = OrderedDict()
     for i in range(1, len(split_xrandr_output), 2):
@@ -447,6 +449,10 @@ def apply_configuration(configuration, dry_run=False):
             disable_argv = []
 
     # Enable remaining outputs in pairs of two
+    # This is required because some drivers can't handle enabling many outputs
+    # in one call. See
+    # https://github.com/phillipberndt/autorandr/pull/6
+    # and commits f4cce4d and 8429886.
     remaining_outputs = [ x for x in outputs if configuration[x].edid ]
     for index in range(0, len(remaining_outputs), 2):
         argv = base_argv[:]