From: Don Armstrong Date: Fri, 22 Apr 2022 23:53:21 +0000 (-0700) Subject: New upstream version 1.12.1 X-Git-Tag: upstream/1.12.1^0 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2c9c4ea84da4b9ec5d75d427dffcdd4e16b43d89;hp=27f58316cda662acb8a4511e0b48bd82a3e094dd;p=deb_pkgs%2Fautorandr.git New upstream version 1.12.1 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a01ee28 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.*.swp diff --git a/README.md b/README.md index 65603c2..7d320a1 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ you can * Use the [nix package](https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/autorandr.nix) on NixOS. +* Use the [SlackBuild](https://slackbuilds.org/repository/14.2/desktop/autorandr/) on Slackware. * Use the automated nightlies generated by the [openSUSE build service](https://build.opensuse.org/package/show/home:phillipberndt/autorandr) for various distributions (RPM and DEB based). @@ -146,9 +147,20 @@ names in your configuration directory to have autorandr use any of them as the default configuration without you having to change the system-wide configuration. -You can store default values for any option in an INI-file in -`~/.config/autorandr/settings.ini` in a section `config`. The most useful -candidate for doing that is `skip-options`, if you need it. +You can store default values for any option in an INI-file located at +`~/.config/autorandr/settings.ini`. In a `config` section, you may place any +default values in the form `option-name=option-argument`. + +A common and effective use of this is to specify default `skip-options`, for +instance skipping the `gamma` setting if using +[`redshift`](https://github.com/jonls/redshift) as a daemon. To implement +the equivalent of `--skip-options gamma`, your `settings.ini` file should look +like this: + +``` +[config] +skip-options=gamma +``` ## Advanced usage @@ -193,17 +205,30 @@ it has a unique name. If you switch back from `docked` to `mobile`, `~/.config/autorandr/postswitch` is executed instead of the `docked` specific `postswitch`. -In these scripts, some of autorandr's state is exposed as environment variables +If you experience issues with xrandr being executed too early after connecting +a new monitor, then you can use a `predetect` script to delay the execution. +Write e.g. `sleep 1` into that file to make autorandr wait a second before +running `xrandr`. + +#### Variables + +Some of autorandr's state is exposed as environment variables prefixed with `AUTORANDR_`, such as: - `AUTORANDR_CURRENT_PROFILE` - `AUTORANDR_CURRENT_PROFILES` - `AUTORANDR_PROFILE_FOLDER` - `AUTORANDR_MONITORS` -If you experience issues with xrandr being executed too early after connecting -a new monitor, then you can use a `predetect` script to delay the execution. -Write e.g. `sleep 1` into that file to make autorandr wait a second before -running `xrandr`. +with the intention that they can be used within the hook scripts. + +For instance, you might display which profile has just been activated by +including the following in a `postswitch` script: +```sh +notify-send -i display "Display profile" "$AUTORANDR_CURRENT_PROFILE" +``` + +The one kink is that during `preswitch`, `AUTORANDR_CURRENT_PROFILE` is +reporting the *upcoming* profile rather than the *current* one. ### Wildcard EDID matching @@ -224,6 +249,15 @@ options nvidia_drm modeset=1 ## Changelog +**autorandr 1.12.1** +* *2021-12-22* Fix `--match-edid` (see #273) + +**autorandr 1.12** +* *2021-12-16* Switch default interpreter to Python 3 +* *2021-12-16* Add `--list` to list all profiles +* *2021-12-16* Add `--cycle` to cycle all detected profiles +* *2021-12-16* Store display properties (see #204) + **autorandr 1.11** * *2020-05-23* Handle empty sys.executable * *2020-06-08* Fix Python 2 compatibility diff --git a/autorandr.1 b/autorandr.1 index d268822..d20264b 100644 --- a/autorandr.1 +++ b/autorandr.1 @@ -38,6 +38,9 @@ List only the current (active) configuration(s) .BR \-\-config Dump the variable values of your current xrandr setup .TP +.BR \-\-cycle +Cycle through all detected profiles +.TP .BR \-\-debug Enable verbose output .TP @@ -50,14 +53,31 @@ Don't change anything, only print the xrandr commands .BR \-\-fingerprint Fingerprint the current hardware setup .TP +.BR \-\-match-edid +Match displays based on edid instead of name +.TP .BR \-\-force Force loading or reloading of a profile .TP +.BR \-\-list +List all profiles +.TP \fB\-\-skip\-options [\fIOPTION\fR] ... \fRSet a comma\-separated list of xrandr arguments to skip both in change detection and profile application. See \fBxrandr(1)\fR for xrandr arguments. .TP .BR \-\-version Show version information and exit +.SH FILES +Configuration files are searched for in the \fIautorandr +\fRdirectory in the colon separated list of paths in \fI$XDG_CONFIG_DIRS +\fR- or in \fI/etc/xdg +\fRif that var is not set. They are then looked for in \fI~/.autorandr +\fRand if that doesn't exist, in \fI$XDG_CONFIG_HOME/autorandr +\fRor in \fI~/.config/autorandr\fR if that var is unset. + +In each of those directories it looks for directories with \fIconfig\fR and +\fIsetup\fR in them. It is best to manage these files with the +\fBautorandr\fR utility. .SH AUTHOR \fRPhillip Berndt .br diff --git a/autorandr.py b/autorandr.py index 25b0f53..6d0163c 100755 --- a/autorandr.py +++ b/autorandr.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # encoding: utf-8 # # autorandr.py @@ -32,6 +32,7 @@ import os import posix import pwd import re +import shlex import subprocess import sys import shutil @@ -39,16 +40,20 @@ import time import glob from collections import OrderedDict -from distutils.version import LooseVersion as Version from functools import reduce from itertools import chain +try: + from packaging.version import Version +except ModuleNotFoundError: + from distutils.version import LooseVersion as Version + if sys.version_info.major == 2: import ConfigParser as configparser else: import configparser -__version__ = "1.11" +__version__ = "1.12.1" try: input = raw_input @@ -64,6 +69,20 @@ virtual_profiles = [ ("vertical", "Stack all connected outputs vertically at their largest resolution", None), ] +properties = [ + "Colorspace", + "max bpc", + "aspect ratio", + "Broadcast RGB", + "audio", + "non-desktop", + "TearFree", + "underscan vborder", + "underscan hborder", + "underscan", + "scaling mode", +] + help_text = """ Usage: autorandr [options] @@ -76,11 +95,14 @@ Usage: autorandr [options] --batch run autorandr for all users with active X11 sessions --current only list current (active) configuration(s) --config dump your current xrandr setup +--cycle automatically load the next detected profile --debug enable verbose output --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