X-Git-Url: https://git.ralfj.de/lilass.git/blobdiff_plain/48a8774e9e7fdbb87fbf4b8ff96c15dd5a69db46..fa823bb6e20373991482a7d07476742452487543:/dsl.py diff --git a/dsl.py b/dsl.py index d959b07..396468d 100755 --- a/dsl.py +++ b/dsl.py @@ -1,5 +1,20 @@ #!/usr/bin/python # DSL - easy Display Setup for Laptops +# Copyright (C) 2012 Ralf Jung +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program (gpl.txt); if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import os, sys, re, subprocess from PyQt4 import QtGui @@ -7,7 +22,7 @@ from selector_window import PositionSelection app = QtGui.QApplication(sys.argv) # for auto-config: common names of internal connectors -commonInternalConnectorNames = ['LVDS', 'LVDS1'] +commonInternalConnectorNames = ['LVDS', 'LVDS0', 'LVDS1', 'LVDS-0', 'LVDS-1'] # Load a section-less config file: maps parameter names to space-separated lists of strings (with shell quotation) def loadConfigFile(file): @@ -26,8 +41,7 @@ def loadConfigFile(file): # parse line pos = line.index("=") # will raise exception when substring is not found curKey = line[:pos].strip() - value = line[pos+1:] - result[curKey] = shlex.split(value) + result[curKey] = shlex.split(line[pos+1:]) # shlex.split also strips except Exception: raise Exception("Invalid config, line %d: Error parsing line (quoting issue?)" % linenr) # add some convencience get functions @@ -38,8 +52,11 @@ def getXrandrInformation(): connectors = {} # map of connector names to a list of resolutions connector = None # current connector for line in p.stdout: + # ignore screens + if line.startswith("Screen"): + continue # new connector? - m = re.search(r'^([\w]+) (dis)?connected ', line) + m = re.search(r'^([\w\-]+) (dis)?connected ', line) if m is not None: connector = m.groups()[0] assert connector not in connectors