]> oss.titaniummirror.com Git - dispcfg.git/commitdiff
Re-xrand even if 'identical'
authorR. Steve McKown <rsmckown@gmail.com>
Fri, 23 Jan 2015 07:49:55 +0000 (00:49 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Fri, 23 Jan 2015 07:49:55 +0000 (00:49 -0700)
To ensure preferred resolution, set primary, and remove any mirroring,
etc.

xrandr_configure_outputs.py

index 7b7f03a788cd2183e00cf6c3b62c6a2c0130701d..d03e9b551556c264a90bdcbbd0f4c436de432caf 100644 (file)
@@ -160,32 +160,28 @@ if __name__ == '__main__':
             touse_outputs = touse_outputs[:-1]
         print_outputs('To use outputs', touse_outputs)
 
-        if touse_outputs == enabled_outputs:
-            # If the touse_outputs list is the same as the enabled_outputs
-            # list, then presumably there is no change made
-            print 'Identical'
-        else:
-            # Determine which outputs to turn off, and which to turn on
-            off_outputs = [output for output in enabled_outputs if output not in
-                    touse_outputs]
-            print_outputs('Turn these off', off_outputs)
-            on_outputs = [output for output in touse_outputs if output not in
-                    enabled_outputs]
-            print_outputs('Turn these on', on_outputs)
-
-            if len(enabled_outputs) < 1 or len(enabled_outputs) > 2 or \
-                    len(touse_outputs) < 1 or len(touse_outputs) > 2:
-                print 'Something is wrong; doing nothing'
-                return
-
-            # Compute positions for final outputs
-            posx = 0
-            for output in touse_outputs:
-                output['posx'] = posx
-                output['posy'] = 0
-                posx += output['width']
-            print_outputs('touse, with positions', touse_outputs)
-
+        # Determine which outputs to turn off, and which to turn on
+        off_outputs = [output for output in enabled_outputs if output not in
+                touse_outputs]
+        print_outputs('Turn these off', off_outputs)
+        on_outputs = [output for output in touse_outputs if output not in
+                enabled_outputs]
+        print_outputs('Turn these on', on_outputs)
+
+        if len(enabled_outputs) < 1 or len(enabled_outputs) > 2 or \
+                len(touse_outputs) < 1 or len(touse_outputs) > 2:
+            print 'Something is wrong; doing nothing'
+            return
+
+        # Compute positions for final outputs
+        posx = 0
+        for output in touse_outputs:
+            output['posx'] = posx
+            output['posy'] = 0
+            posx += output['width']
+        print_outputs('touse, with positions', touse_outputs)
+
+        if touse_outputs != enabled_outputs:
             # Remove all enabled outputs save one
             while len(enabled_outputs) > 1:
                 output = enabled_outputs[0]
@@ -208,9 +204,9 @@ if __name__ == '__main__':
             if not output_by_name(touse_outputs, last_old_output['name']):
                 xrandr_off(last_old_output)
 
-            # Now add the remaining touse outputs
-            for output in touse_outputs:
-                xrandr_on(output)
+        # Now add the remaining touse outputs
+        for output in touse_outputs:
+            xrandr_on(output)
 
 
     main(sys.argv)