diff --git a/xrandroll/main.py b/xrandroll/main.py index cf6be40..d9a151e 100644 --- a/xrandroll/main.py +++ b/xrandroll/main.py @@ -158,9 +158,10 @@ class Window(QObject): for mon in self.screen.monitors.values(): mon.item.update_visuals(mon) - def run(self, cli): - print(f"Running {cli}") - subprocess.check_call(shlex.split(cli)) + def run(self, commands): + for i, cmd in enumerate(commands, 1): + print(f"Running {cmd} [{i}/{len(commands)}]") + subprocess.check_call(shlex.split(cmd)) def do_reset(self): self.run(self.reset_screen.generate()) diff --git a/xrandroll/xrandr.py b/xrandroll/xrandr.py index da6720a..96ceed2 100644 --- a/xrandroll/xrandr.py +++ b/xrandroll/xrandr.py @@ -30,9 +30,10 @@ class Screen: self.update_replica_of() def generate(self): - """Create a xrandr invocation to match this state.""" - cli = ["xrandr"] + """Create a list of xrandr invocations to match this state.""" + results = [] for output, mon in self.monitors.items(): + cli = ["xrandr"] cli.append(f"--output {output}") if not mon.enabled: cli.append("--off") @@ -47,8 +48,8 @@ class Screen: cli.append(f"--rotate {mon.orientation}") if mon.primary: cli.append("--primary") - - return " ".join(cli) + results.append(" ".join(cli)) + return results def update_replica_of(self): """Decide which monitors are replicas of each other and