From 3b2f42ddcc952bebfe1ac5b345865decf78ff3eb Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 2 Apr 2015 11:18:18 +0200 Subject: add support for outputs not being used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/x.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/x.py b/src/x.py index 300bb06..471913b 100644 --- a/src/x.py +++ b/src/x.py @@ -68,15 +68,18 @@ def get_monitors(): s = int(line[len('Screen '):].split(':')[0]) elif s == screen_i: if ' connected ' in line: - m = line.replace('-', '+-').replace('++', '+') - p = ' primary ' in m - m = m.replace(' primary ', ' ') - m = m.split(' ')[2].replace('+', 'x').split('x') - m = [int(x) for x in m] - if p and (prim is None): - prim = m - else: - rc.append(m) + try: + m = line.replace('-', '+-').replace('++', '+') + p = ' primary ' in m + m = m.replace(' primary ', ' ') + m = m.split(' ')[2].replace('+', 'x').split('x') + m = [int(x) for x in m] + if p and (prim is None): + prim = m + else: + rc.append(m) + except: + pass # Output not used if prim is not None: rc = [prim] + rc return rc -- cgit v1.2.3-70-g09d2