xrandr module: add dynamic primary configuration
@@ -94,6 +94,8 @@ Dynamic configuration parameters:
<OUTPUT>_mode: define the mode (resolution) for the output
if not specified use --auto : prefered mode
Example: eDP1_mode = "2560x1440
+ <OUTPUT>_primary: apply the primary to the OUTPUT
+ Example: DP1_primary = True
Color options:
color_bad: Displayed layout unavailable
@@ -322,18 +324,23 @@ class Py3status:
outputs = list(self.layout["connected"].keys())
outputs += list(self.layout["disconnected"].keys())
previous_output = None
+ primary_added = False
for output in outputs:
cmd += " --output {}".format(output)
#
if output in combination:
pos = getattr(self, "{}_pos".format(output), "0x0")
- rotation = getattr(self, "{}_rotate".format(output), "normal")
+ primary = getattr(self, "{}_primary".format(output), None)
resolution = getattr(self, "{}_mode".format(output), None)
resolution = "--mode {}".format(resolution) if resolution else "--auto"
+ rotation = getattr(self, "{}_rotate".format(output), "normal")
if rotation not in ["inverted", "left", "normal", "right"]:
self.py3.log("configured rotation {} is not valid".format(rotation))
rotation = "normal"
#
+ if primary is True and not primary_added:
+ primary_added = True
+ cmd += " --primary"
if mode == "clone" and previous_output is not None:
cmd += " {} --same-as {}".format(resolution, previous_output)
else:
