projects
/
lilass.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
store the screen resolution as numberas and convert it back to a string as needed
[lilass.git]
/
external_screen.py
diff --git
a/external_screen.py
b/external_screen.py
index a8742a37d295c3788448ada6f515b5646cd42c7b..e365ef58b51e082b3c3edd2af8047b6a39ee4bdd 100755
(executable)
--- a/
external_screen.py
+++ b/
external_screen.py
@@
-17,12
+17,16
@@
def getXrandrInformation():
connectors[connector] = []
continue
# new resolution?
connectors[connector] = []
continue
# new resolution?
- m = re.search('^ ([\d]+
x
[\d]+) +', line)
+ m = re.search('^ ([\d]+
)x(
[\d]+) +', line)
if m is not None:
assert connector is not None
if m is not None:
assert connector is not None
- connectors[connector].append(
int(m.groups()[0]
))
+ connectors[connector].append(
(int(m.groups()[0]), int(m.groups()[1])
))
return connectors
return connectors
+def res2str(res):
+ (w, h) = res
+ return str(w)+'x'+str(h)
+
# Check screen setup
internalName = "LVDS"
externalName = "CRT1"
# Check screen setup
internalName = "LVDS"
externalName = "CRT1"
@@
-31,10
+35,10
@@
internalResolutions = connectors[internalName] # there must be a screen assoicat
externalResolutions = connectors.get(externalName)
# Check what to do
externalResolutions = connectors.get(externalName)
# Check what to do
-internalArgs = ["--mode",
internalResolutions[0]
] # there must be a resolution for the internal screen
+internalArgs = ["--mode",
res2str(internalResolutions[0])
] # there must be a resolution for the internal screen
externalArgs = ["--off"]
if externalResolutions is not None: # we need to ask what to do
externalArgs = ["--off"]
if externalResolutions is not None: # we need to ask what to do
- extPosition = PositionSelection(
externalResolutions
)
+ extPosition = PositionSelection(
map(res2str, externalResolutions)
)
extPosition.exec_()
if not extPosition.result(): sys.exit(1) # the user canceled
# build command-line
extPosition.exec_()
if not extPosition.result(): sys.exit(1) # the user canceled
# build command-line