]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Merge branch 'master' into master
authorPhillip Berndt <phillip.berndt@googlemail.com>
Thu, 16 Dec 2021 09:39:52 +0000 (10:39 +0100)
committerGitHub <noreply@github.com>
Thu, 16 Dec 2021 09:39:52 +0000 (10:39 +0100)
1  2 
autorandr.1
autorandr.py
contrib/bash_completion/autorandr
contrib/zsh_completion/_autorandr

diff --cc autorandr.1
Simple merge
diff --cc autorandr.py
index 6ebd55261bf83d503acf5f1257ff05426b892411,7ad9736b136f516a7f0309a3b80b17f907b53809..24d8b3a9df0674291c91ac88756975fc08223315
@@@ -80,8 -85,8 +85,9 @@@ Usage: autorandr [options
  --detected              only list detected (available) configuration(s)
  --dry-run               don't change anything, only print the xrandr commands
  --fingerprint           fingerprint your current hardware setup
 +--match-edid            match diplays based on edid instead of name
  --force                 force (re)loading of a profile / overwrite exiting files
+ --list                  list configurations
  --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
@@@ -1240,9 -1215,9 +1246,9 @@@ def read_config(options, directory)
  def main(argv):
      try:
          opts, args = getopt.getopt(argv[1:], "s:r:l:d:cfh",
-                                    ["batch", "dry-run", "change", "default=", "save=", "remove=", "load=",
+                                    ["batch", "dry-run", "change", "cycle", "default=", "save=", "remove=", "load=",
                                      "force", "fingerprint", "config", "debug", "skip-options=", "help",
-                                     "current", "detected", "version", "match-edid"])
 -                                    "list", "current", "detected", "version"])
++                                    "list", "current", "detected", "version", "match-edid"])
      except getopt.GetoptError as e:
          print("Failed to parse options: {0}.\n"
                "Use --help to get usage information.".format(str(e)),
      exec_scripts(None, "predetect")
      config, modes = parse_xrandr_output()
  
-     # Sort by descending mtime
-     profiles = OrderedDict(sorted(profiles.items(), key=lambda x: -x[1]["config-mtime"]))
 +    if "--match-edid" in options:
 +        update_profiles_edid(profiles, config)
 +
++    # Sort by mtime
++    sort_direction = -1
++    if "--cycle" in options:
++        # When cycling through profiles, put the profile least recently used to the top of the list
++        sort_direction = 1
++    profiles = OrderedDict(sorted(profiles.items(), key=lambda x: sort_direction * x[1]["config-mtime"]))
 +    profile_symlinks = {k: v for k, v in profile_symlinks.items() if v in (x[0] for x in virtual_profiles) or v in profiles}
 +
      if "--fingerprint" in options:
          output_setup(config, sys.stdout)
          sys.exit(0)
index f7bef4f2bdb479469939b3fa0d6d78d3eee608d4,904ef8035e557e34a20b381d6a3ccbe9872b1418..0af11ec70834a7b2e0bdeb3a95f1f0a75d6c8ce2
@@@ -10,7 -10,7 +10,7 @@@ _autorandr (
        prev="${COMP_WORDS[COMP_CWORD-1]}"
  
        opts="-h -c -s -r -l -d"
-       lopts="--help --change --save --remove --load --default --force --fingerprint --match-edid --config --dry-run"
 -      lopts="--help --change --cycle --save --remove --load --list --default --force --fingerprint --config --dry-run"
++      lopts="--help --change --cycle --save --remove --load --list --default --force --fingerprint  --match-edid --config --dry-run"
  
        # find system-level autorandr dirs
        OIFS="$IFS"
index e17fc00e275b9b51672d52cb640fc589b7975282,848f614aaaf646e594faac0ad7b9e31ee0a8d4a3..1667f0c560a75a030c9613e89a9b387468ed4991
@@@ -32,8 -33,8 +33,9 @@@ _autorandr () 
         --debug"[enable verbose output]" \
         --dry-run"[don't change anything]" \
         --fingerprint"[fingerprint current hardware]" \
 +       --match-edid"[match displays using edid]" \
         --force"[force loading of a profile]" \
+        --list"[list all profiles]" \
         --skip-options"[skip xrandr options]:xrandr options:_values -s , options gamma brightness panning transform primary mode pos rate" \
         --version"[show version]"
  }