def _apply(self, force=False):
if self.displayed == self.active_layout and not force:<EOL><INDENT>return<EOL><DEDENT>combination, mode = self.combinations_map.get(self.displayed, (None, None))<EOL>if combination is None and mode is None:<EOL><INDENT>return<EOL><DEDENT>cmd = "<STR_LIT>"<EOL>outputs = list(self.layout["<STR_LIT>"].keys())<EOL>outputs += list(self.layout["<STR_LIT>"].keys())<EOL>previous_output = None<EOL>primary_added = False<EOL>for output in outputs:<EOL><INDENT>cmd += "<STR_LIT>".format(output)<EOL>if output in combination:<EOL><INDENT>pos = getattr(self, "<STR_LIT>".format(output), "<STR_LIT>")<EOL>primary = getattr(self, "<STR_LIT>".format(output), None)<EOL>resolution = getattr(self, "<STR_LIT>".format(output), None)<EOL>resolution = "<STR_LIT>".format(resolution) if resolution else "<STR_LIT>"<EOL>rotation = getattr(self, "<STR_LIT>".format(output), "<STR_LIT>")<EOL>if rotation not in ["<STR_LIT>", "<STR_LIT:left>", "<STR_LIT>", "<STR_LIT:right>"]:<EOL><INDENT>self.py3.log("<STR_LIT>".format(rotation))<EOL>rotation = "<STR_LIT>"<EOL><DEDENT>if primary is True and not primary_added:<EOL><INDENT>primary_added = True<EOL>cmd += "<STR_LIT>"<EOL><DEDENT>if mode == "<STR_LIT>" and previous_output is not None:<EOL><INDENT>cmd += "<STR_LIT>".format(resolution, previous_output)<EOL><DEDENT>else:<EOL><INDENT>if (<EOL>"<STR_LIT>" in pos<EOL>or "<STR_LIT>" in pos<EOL>or "<STR_LIT>" in pos<EOL>or "<STR_LIT>" in pos<EOL>):<EOL><INDENT>cmd += "<STR_LIT>".format(resolution, pos, rotation)<EOL><DEDENT>else:<EOL><INDENT>cmd += "<STR_LIT>".format(<EOL>resolution, pos, rotation<EOL>)<EOL><DEDENT><DEDENT>previous_output = output<EOL><DEDENT>else:<EOL><INDENT>cmd += "<STR_LIT>"<EOL><DEDENT><DEDENT>code = self.py3.command_run(cmd)<EOL>if code == <NUM_LIT:0>:<EOL><INDENT>self.active_comb = combination<EOL>self.active_layout = self.displayed<EOL>self.active_mode = mode<EOL><DEDENT>self.py3.log('<STR_LIT>'.format(cmd, code))<EOL>if self.command:<EOL><INDENT>self.py3.command_run(self.command)<EOL><DEDENT>self._apply_workspaces(combination, mode)<EOL>
Call xrandr and apply the selected (displayed) combination mode.