projects
/
lilass.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6f78b3a
)
make sure the xrandr we call to get information properly quits, and detect failure...
author
Ralf Jung
<post@ralfj.de>
Wed, 27 Jun 2012 20:35:09 +0000
(22:35 +0200)
committer
Ralf Jung
<post@ralfj.de>
Wed, 27 Jun 2012 20:37:44 +0000
(22:37 +0200)
external_screen.py
patch
|
blob
|
history
diff --git
a/external_screen.py
b/external_screen.py
index e365ef58b51e082b3c3edd2af8047b6a39ee4bdd..a419908a2a95ffe8f50c55cf0645ac78b23fed2a 100755
(executable)
--- a/
external_screen.py
+++ b/
external_screen.py
@@
-10,17
+10,19
@@
def getXrandrInformation():
connector = None # current connector
for line in p.stdout:
# new connector?
connector = None # current connector
for line in p.stdout:
# new connector?
- m = re.search('^([\w]+) connected ', line)
+ m = re.search(
r
'^([\w]+) connected ', line)
if m is not None:
connector = m.groups()[0]
assert connector not in connectors
connectors[connector] = []
continue
# new resolution?
if m is not None:
connector = m.groups()[0]
assert connector not in connectors
connectors[connector] = []
continue
# new resolution?
- m = re.search('^ ([\d]+)x([\d]+) +', line)
+ m = re.search(
r
'^ ([\d]+)x([\d]+) +', line)
if m is not None:
assert connector is not None
connectors[connector].append((int(m.groups()[0]), int(m.groups()[1])))
if m is not None:
assert connector is not None
connectors[connector].append((int(m.groups()[0]), int(m.groups()[1])))
+ p.communicate()
+ if p.returncode != 0: raise Exception("Querying xrandr for data failed")
return connectors
def res2str(res):
return connectors
def res2str(res):
@@
-50,6
+52,6
@@
if externalResolutions is not None: # we need to ask what to do
else:
externalArgs += ["--right-of", internalName]
# and do it
else:
externalArgs += ["--right-of", internalName]
# and do it
-
args = [
"--output", internalName] + internalArgs + ["--output", externalName] + externalArgs
-print
args
-subprocess.check_call(
["xrandr"] + args
)
+
call = ["xrandr",
"--output", internalName] + internalArgs + ["--output", externalName] + externalArgs
+print
"Call that will be made:",call
+subprocess.check_call(
call
)