def _get_layout(self):
connected = list()<EOL>active_layout = list()<EOL>disconnected = list()<EOL>layout = OrderedDict(<EOL>{"<STR_LIT>": OrderedDict(), "<STR_LIT>": OrderedDict()}<EOL>)<EOL>current = self.py3.command_output("<STR_LIT>")<EOL>for line in current.splitlines():<EOL><INDENT>try:<EOL><INDENT>s = line.split("<STR_LIT:U+0020>")<EOL>infos = line[line.find("<STR_LIT:(>") :]<EOL>if s[<NUM_LIT:1>] == "<STR_LIT>":<EOL><INDENT>output, state, mode = s[<NUM_LIT:0>], s[<NUM_LIT:1>], None<EOL>for index, x in enumerate(s[<NUM_LIT:2>:], <NUM_LIT:2>):<EOL><INDENT>if "<STR_LIT:x>" in x and "<STR_LIT:+>" in x:<EOL><INDENT>mode = x<EOL>active_layout.append(output)<EOL>infos = line[line.find(s[index + <NUM_LIT:1>]) :]<EOL>break<EOL><DEDENT>elif "<STR_LIT:(>" in x:<EOL><INDENT>break<EOL><DEDENT><DEDENT>connected.append(output)<EOL><DEDENT>elif s[<NUM_LIT:1>] == "<STR_LIT>":<EOL><INDENT>output, state, mode = s[<NUM_LIT:0>], s[<NUM_LIT:1>], None<EOL>disconnected.append(output)<EOL><DEDENT>else:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>except Exception as err:<EOL><INDENT>self.py3.log('<STR_LIT>'.format(err))<EOL><DEDENT>else:<EOL><INDENT>layout[state][output] = {"<STR_LIT>": infos, "<STR_LIT>": mode, "<STR_LIT:state>": state}<EOL><DEDENT><DEDENT>if self.active_layout is None:<EOL><INDENT>self.active_comb = tuple(active_layout)<EOL>self.active_layout = self._get_string_and_set_width(<EOL>tuple(active_layout), self.active_mode<EOL>)<EOL><DEDENT>return layout<EOL>
Get the outputs layout from xrandr and try to detect the
currently active layout as best as we can on start.