From d6ba2bdc66f5712d639a3fdab3f514b8d9b41eca Mon Sep 17 00:00:00 2001 From: gryf Date: Sun, 15 Oct 2017 12:19:28 +0200 Subject: [PATCH] Added python3 support --- README.rst | 24 ++++++++++++++++++++---- pyrandr.py | 4 ++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 90595db..91ec505 100644 --- a/README.rst +++ b/README.rst @@ -7,9 +7,8 @@ simple as possible. Requirements ------------ -``pyrandr`` doesn't require any other thing than python and ``xrandr`` command -line tool. Currently it is tested only on Python2.7, support for Python3 is -coming. +``pyrandr`` doesn't require any other thing than Python (any version starting +from Python 2.7) and ``xrandr`` command line tool. Installation ------------ @@ -25,7 +24,24 @@ Invocation is simple, executing the script: user@localhost $ pyrandr.py -should list all mailable outputs for your display device(s) +should list all mailable outputs for your display device(s). + +There is a mode for turning all displays at once called panic mode: + +.. code:: shell-session + + user@localhost $ pyrandr.py -a + +And most interesting part is ability to turn on selected outputs side by side +in horizontal layout, for example: + +.. code:: shell-session + + user@localhost $ pyrandr.py -p VGA1 VGA2 VGA1 + +Will switch off all other outputs, but ``VGA1`` and ``VGA2``, and place those +outputs in order ``VGA1`` on the right of ``VGA2``. The option ``-p`` will set +``VGA1`` as the primary output. Use ``--help`` to see all the other options: diff --git a/pyrandr.py b/pyrandr.py index ba75672..433a2b8 100755 --- a/pyrandr.py +++ b/pyrandr.py @@ -90,7 +90,7 @@ class Organizer(object): in_output = False - for line in xrandr.split('\n'): + for line in xrandr.decode().split('\n'): match = DISPLAY_RE.match(line) if match: data = match.groupdict() @@ -113,7 +113,7 @@ class Organizer(object): def output_list(self): for name in sorted(self._outputs.keys()): - print self._outputs[name] + print(self._outputs[name]) def set_single(self, out_name): pass