X-Git-Url: https://code.delx.au/bg-scripts/blobdiff_plain/7fef5e45b01eb71bba28aefb7a50be3fcca9345c..f667bb5991af1eb85cb9585b4dfbdf7ea80f6024:/lib/x11_helpers.py diff --git a/lib/x11_helpers.py b/lib/x11_helpers.py deleted file mode 100644 index b479132..0000000 --- a/lib/x11_helpers.py +++ /dev/null @@ -1,38 +0,0 @@ -#! python -# Copyright 2007 Greg Darke -# Licensed for distribution under the GPL version 2, check COPYING for details -# Some little helper utils - -import subprocess, commands, itertools - -__all__ = ('getResolutions', ) - -def _seperateGroups(lines): - ret = [] - current_section = [] - for line in lines: - if line.strip() == '': - ret.append(current_section) - current_section = [] - continue - current_section.append(line) - if current_section: - ret.append(current_section) - return ret - -def getResolutions(): - xdpyinfo_status, xdpyinfo_output = commands.getstatusoutput('xdpyinfo') - lines = xdpyinfo_output.splitlines() - groups = _seperateGroups(xdpyinfo_output.splitlines()) - - screens = [] - for screen_data in itertools.islice(groups, 1, None, None): - _, screen_number = screen_data[0].split() - # remove the leading and trailing characters - screen_number = screen_number[1:-1] - - _, screen_resolution_str, _, _, _ = screen_data[1].strip().split() - screen_resolution = screen_resolution_str.split('x') - - screens.append( (screen_number, tuple(int(val) for val in screen_resolution))) - return dict(screens)