mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-24 12:02:23 +00:00
Use multiple xrandr invocations
This commit is contained in:
parent
a13c3436ef
commit
eb17909563
@ -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())
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user