mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-22 02:52: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():
|
for mon in self.screen.monitors.values():
|
||||||
mon.item.update_visuals(mon)
|
mon.item.update_visuals(mon)
|
||||||
|
|
||||||
def run(self, cli):
|
def run(self, commands):
|
||||||
print(f"Running {cli}")
|
for i, cmd in enumerate(commands, 1):
|
||||||
subprocess.check_call(shlex.split(cli))
|
print(f"Running {cmd} [{i}/{len(commands)}]")
|
||||||
|
subprocess.check_call(shlex.split(cmd))
|
||||||
|
|
||||||
def do_reset(self):
|
def do_reset(self):
|
||||||
self.run(self.reset_screen.generate())
|
self.run(self.reset_screen.generate())
|
||||||
|
@ -30,9 +30,10 @@ class Screen:
|
|||||||
self.update_replica_of()
|
self.update_replica_of()
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
"""Create a xrandr invocation to match this state."""
|
"""Create a list of xrandr invocations to match this state."""
|
||||||
cli = ["xrandr"]
|
results = []
|
||||||
for output, mon in self.monitors.items():
|
for output, mon in self.monitors.items():
|
||||||
|
cli = ["xrandr"]
|
||||||
cli.append(f"--output {output}")
|
cli.append(f"--output {output}")
|
||||||
if not mon.enabled:
|
if not mon.enabled:
|
||||||
cli.append("--off")
|
cli.append("--off")
|
||||||
@ -47,8 +48,8 @@ class Screen:
|
|||||||
cli.append(f"--rotate {mon.orientation}")
|
cli.append(f"--rotate {mon.orientation}")
|
||||||
if mon.primary:
|
if mon.primary:
|
||||||
cli.append("--primary")
|
cli.append("--primary")
|
||||||
|
results.append(" ".join(cli))
|
||||||
return " ".join(cli)
|
return results
|
||||||
|
|
||||||
def update_replica_of(self):
|
def update_replica_of(self):
|
||||||
"""Decide which monitors are replicas of each other and
|
"""Decide which monitors are replicas of each other and
|
||||||
|
Loading…
Reference in New Issue
Block a user