From: R. Steve McKown Date: Fri, 23 Jan 2015 07:49:55 +0000 (-0700) Subject: Re-xrand even if 'identical' X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=dispcfg.git;a=commitdiff_plain;h=86198a3383ed966dd59cc8f583d69bf0c48b7ba5 Re-xrand even if 'identical' To ensure preferred resolution, set primary, and remove any mirroring, etc. --- diff --git a/xrandr_configure_outputs.py b/xrandr_configure_outputs.py index 7b7f03a..d03e9b5 100644 --- a/xrandr_configure_outputs.py +++ b/xrandr_configure_outputs.py @@ -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)