]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blobdiff - autorandr.py
Version bump: autorandr 1.5
[deb_pkgs/autorandr.git] / autorandr.py
index b363b9eb747c3fdcdc925ec363d9729b5c45e133..5a0a6860fea0c82bf72e1521781cbd06513f71a4 100755 (executable)
@@ -26,6 +26,7 @@ from __future__ import print_function
 
 import binascii
 import copy
+import fnmatch
 import getopt
 import hashlib
 import os
@@ -47,6 +48,8 @@ if sys.version_info.major == 2:
 else:
     import configparser
 
+__version__ = "1.5"
+
 try:
     input = raw_input
 except NameError:
@@ -80,6 +83,7 @@ Usage: autorandr [options]
 --force                 force (re)loading of a profile
 --skip-options <option> comma separated list of xrandr arguments (e.g. "gamma")
                         to skip both in detecting changes and applying a profile
+--version               show version information and exit
 
  If no suitable profile can be identified, the current configuration is kept.
  To change this behaviour and switch to a fallback configuration, specify
@@ -399,6 +403,10 @@ class XrandrOutput(object):
                 return hashlib.md5(binascii.unhexlify(other.edid)).hexdigest() == self.edid
             if len(self.edid) != 32 and len(other.edid) == 32 and not self.edid.startswith(XrandrOutput.EDID_UNAVAILABLE):
                 return hashlib.md5(binascii.unhexlify(self.edid)).hexdigest() == other.edid
+            if "*" in self.edid:
+                return fnmatch.fnmatch(other.edid, self.edid)
+            elif "*" in other.edid:
+                return fnmatch.fnmatch(self.edid, other.edid)
         return self.edid == other.edid
 
     def __ne__(self, other):
@@ -1029,7 +1037,7 @@ def main(argv):
         opts, args = getopt.getopt(argv[1:], "s:r:l:d:cfh",
                                    ["batch", "dry-run", "change", "default=", "save=", "remove=", "load=",
                                     "force", "fingerprint", "config", "debug", "skip-options=", "help",
-                                    "current", "detected"])
+                                    "current", "detected", "version"])
     except getopt.GetoptError as e:
         print("Failed to parse options: {0}.\n"
               "Use --help to get usage information.".format(str(e)),
@@ -1041,6 +1049,10 @@ def main(argv):
     if "-h" in options or "--help" in options:
         exit_help()
 
+    if "--version" in options:
+        print("autorandr " + __version__)
+        sys.exit(0)
+
     if "--current" in options and "--detected" in options:
         print("--current and --detected are mutually exclusive.", file=sys.stderr)
         sys.exit(posix.EX_USAGE)