diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-04-03 01:06:47 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-04-03 01:06:47 +0200 |
commit | b51821368c23ee017317ae9fe16e797662e1a1ba (patch) | |
tree | 219091df543ea40bdb6a86498fad005a7ad4685f /src/icc.py | |
parent | move some issues from 'future stuff' into the issue tracker on github (diff) | |
download | blueshift-b51821368c23ee017317ae9fe16e797662e1a1ba.tar.gz blueshift-b51821368c23ee017317ae9fe16e797662e1a1ba.tar.bz2 blueshift-b51821368c23ee017317ae9fe16e797662e1a1ba.tar.xz |
add multi-display support when listing moditors and getting icc profile
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/icc.py | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -42,23 +42,29 @@ def load_icc(pathname): return parse_icc(file.read()) -def get_current_icc(): +def get_current_icc(display = None): ''' Get all currently applied ICC profiles as profile applying functions + @param display:str? The display to use, `None` for the current one @return list<(screen:int, monitor:int, profile:()→void)> List of used profiles ''' - return [(screen, monitor, parse_icc(profile)) for screen, monitor, profile in get_current_icc_raw()] + return [(screen, monitor, parse_icc(profile)) for screen, monitor, profile in get_current_icc_raw(display)] -def get_current_icc_raw(): +def get_current_icc_raw(display = None): ''' Get all currently applied ICC profiles as raw profile data + @param display:str? The display to use, `None` for the current one @return list<(screen:int, monitor:int, profile:bytes())> List of used profiles ''' + # Generate command line arguments to execute + command = [LIBEXECDIR + os.sep + 'blueshift_iccprofile'] + if display is not None: + command.append(display) # Spawn the libexec blueshift_iccprofile - process = Popen([LIBEXECDIR + os.sep + 'blueshift_iccprofile'], stdout = PIPE) + 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 the tha process has exited |