Implemented choose_a_monitor

This commit is contained in:
Roberto Alsina 2020-02-05 18:36:22 -03:00
parent 8159f07724
commit 76a836b82a
1 changed files with 16 additions and 0 deletions

View File

@ -38,6 +38,22 @@ class Screen:
if a != b and is_replica_of(self.monitors[a], self.monitors[b]):
self.monitors[a].replica_of.append(b)
def choose_a_monitor(self):
"""Choose what monitor to select by default.
* Not disabled
* Primary, if possible
"""
candidate = None
for name, mon in self.monitors.items():
if not mon.enabled:
continue
if mon.primary:
return name
candidate = name
return candidate
def read_data():
data = subprocess.check_output(