From 3726c7d9c39be6455eff6d681a810ed929f4e4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 23 Feb 2017 22:31:55 +0100 Subject: [PATCH] python: decode xrandr output earlier, don't use regexp on bytes --- qubes/ext/gui.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qubes/ext/gui.py b/qubes/ext/gui.py index c68b7402..51ca51b0 100644 --- a/qubes/ext/gui.py +++ b/qubes/ext/gui.py @@ -30,7 +30,7 @@ import qubes.ext # "LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm" -REGEX_OUTPUT = re.compile(rb''' +REGEX_OUTPUT = re.compile(r''' (?x) # ignore whitespace ^ # start of string (?P[A-Za-z0-9\-]*)[ ] # LVDS VGA etc @@ -58,7 +58,8 @@ def get_monitor_layout(): for line in subprocess.Popen( ['xrandr', '-q'], stdout=subprocess.PIPE).stdout: - if not line.startswith(b"Screen") and not line.startswith(b" "): + line = line.decode() + if not line.startswith("Screen") and not line.startswith(" "): output_params = REGEX_OUTPUT.match(line).groupdict() if output_params['width']: phys_size = ""