))+
\s*
(?P<modes>(?:
- (?P<mode_width>[0-9]+)x(?P<mode_height>[0-9]+).+?\*current.+\s+
+ (?P<mode_width>[0-9]+)x(?P<mode_height>[0-9]+).+?\*current.*\s+
h:.+\s+v:.+clock\s+(?P<rate>[0-9\.]+)Hz\s* | # Interesting (current) resolution: Extract rate
- [0-9]+x[0-9]+.+\s+h:.+\s+v:.+\s* # Other resolutions
+ [0-9]+x[0-9]+(?:(?!\*current).)+\s+h:.+\s+v:.+\s* # Other resolutions
)*)
"""
remainder = xrandr_output[len(match_object.group(0)):]
if remainder:
raise RuntimeError(("Parsing XRandR output failed, %d bytes left unmatched after regular expression, "
- "starting at byte %d with ..'%s'.") % (len(remainder), len(len(match_object.group(0))), remainder[:10]))
+ "starting at byte %d with ..'%s'.") % (len(remainder), len(match_object.group(0)), remainder[:10]))
match = match_object.groupdict()
if not match["mode_width"]:
# TODO We'd need to apply the reverse transformation here. Let's see if someone complains, I doubt that this
# special case is actually required.
- print("Warning: Output %s has a transformation applied. Could not determine correct mode!", file=sys.stderr)
+ print("Warning: Output %s has a transformation applied. Could not determine correct mode! Using `%s'." % (match["output"], options["mode"]), file=sys.stderr)
if match["gamma"]:
gamma = match["gamma"].strip()
options["gamma"] = gamma