From b51821368c23ee017317ae9fe16e797662e1a1ba Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 3 Apr 2014 01:06:47 +0200 Subject: add multi-display support when listing moditors and getting icc profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/monitor.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/monitor.py') diff --git a/src/monitor.py b/src/monitor.py index 36f9235..d115d40 100644 --- a/src/monitor.py +++ b/src/monitor.py @@ -500,27 +500,33 @@ class Output: return '[Name: %s, Connected: %s, Width: %s, Height: %s, CRTC: %s, Screen: %s, EDID: %s]' % rc -def list_screens(method = 'randr'): +def list_screens(method = 'randr', display = None): ''' Retrieve informantion about all screens, outputs and CRTC:s - @param method:str The listing method: 'randr' for RandR (under X), + @param method:str The listing method: 'randr' for RandR (under X), 'drm' for DRM (under TTY) - @return :Screens An instance of a datastructure with the relevant information + @param display:str? The display to use, `None` for the current one + @return :Screens An instance of a datastructure with the relevant information ''' - if method == 'randr': return list_screens_randr() + if method == 'randr': return list_screens_randr(display = display) if method == 'drm': return list_screens_drm() raise Exception('Invalid method: %s' % method) -def list_screens_randr(): +def list_screens_randr(display = None): ''' Retrieve informantion about all screens, outputs and CRTC:s, using RandR - @return :Screens An instance of a datastructure with the relevant information + @param display:str? The display to use, `None` for the current one + @return :Screens An instance of a datastructure with the relevant information ''' - # Spawn the executeable library blueshift_idcrtc - process = Popen([LIBEXECDIR + os.sep + 'blueshift_idcrtc'], stdout = PIPE) + # Generate command line arguments to execute + command = [LIBEXECDIR + os.sep + 'blueshift_idcrtc'] + if display is not None: + command.append(display) + # Spawn the executable library blueshift_idcrtc + process = Popen(command, stdout = PIPE) # Wait for the child process to exit and gather its output to stdout lines = process.communicate()[0].decode('utf-8', 'error').split('\n') # Ensure that the child process has exited -- cgit v1.2.3-70-g09d2