- if not configuration[output].edid or "off" in configuration[output].options:
- disable_argv += configuration[output].option_vector
- if disable_argv:
- if subprocess.call(base_argv + disable_argv) != 0:
+ if not new_configuration[output].edid or "off" in new_configuration[output].options:
+ disable_outputs.append(new_configuration[output].option_vector)
+ else:
+ if "off" not in current_configuration[output].options:
+ remain_active_count += 1
+ enable_outputs.append(new_configuration[output].option_vector)
+ if xrandr_version() >= Version("1.3.0") and "transform" in current_configuration[output].options:
+ auxiliary_changes_pre.append(["--output", output, "--transform", "none"])
+
+ # Perform pe-change auxiliary changes
+ if auxiliary_changes_pre:
+ argv = base_argv + list(chain.from_iterable(auxiliary_changes_pre))
+ if subprocess.call(argv) != 0:
+ raise RuntimeError("Command failed: %s" % " ".join(argv))
+
+ # Disable unused outputs, but make sure that there always is at least one active screen
+ disable_keep = 0 if remain_active_count else 1
+ if len(disable_outputs) > disable_keep:
+ if subprocess.call(base_argv + list(chain.from_iterable(disable_outputs[:-1] if disable_keep else disable_outputs))) != 0: