Package: autorandr
autorandrAutomatically select a display configuration based on connected devicesBranch informationThis is a compatible Python rewrite ofwertarbyte/autorandr. Contributions
for bash-completion, fd.o/XDG autostart, Nitrogen, pm-utils, and systemd can be
found undercontrib.The originalwertarbyte/autorandrtree is unmaintained, with lots of open pull requests and issues. I forked it
and merged what I thought were the most important changes. If you are searching
for that version, see thelegacybranch.
Note that the Python version is better suited for non-standard configurations,
like if you use--transformor--reflect. If you useauto-disper, you
have to use the bash version, as there is no disper support in the Python
version (yet). Both versions use a compatible configuration file format, so
you can, to some extent, switch between them.  I will maintain thelegacybranch until @wertarbyte finds the time to maintain his branch again.If you are interested in why there are two versions around, see#7,#8and
especially#12if you are unhappy with this version and would like to contribute to the bash
version.License information and authorsautorandr is available under the terms of the GNU General Public License
(version 3).Contributors to this version of autorandr are:Adrián LópezandersonjacobAlexander LochmannAlexander WirtBrice WaegeneireChris DunderChristoph GysinChristophe-Marie DuquesneDaniel HahlerMaciej SitarzMathias SvenssonMatthew R JohnsonNazar MokrynskyiPhillip BerndtRasmus Wriedt LarsenSam CoulterSimon WydoogheStefan TomanekstormctachylatusTimo BingmannTimo KaufmannTomasz BogdalVictor HäggqvistJan-Oliver KaiserAlexandre ViauInstallation/removalYou can use theautorandr.pyscript as a stand-alone binary. If you'd like to
install it as a system-wide application, there is a Makefile included that also
places some configuration files in appropriate directories such that autorandr
is invoked automatically when a monitor is connected or removed, the system
wakes up from suspend, or a user logs into an X11 session. Runmake installas root to install it.If you prefer to have a system wide install managed by your package manager,
you canUse theofficial Arch package.Use theofficial Debian packageon sidUse theFreeBSD Ports Collectionon FreeBSD.Use theofficial Gentoo package.Use thenix packageon NixOS.Use theguix packageon Guix.Use theSlackBuildon Slackware.Use the automated nightlies generated by theopenSUSE build servicefor various distributions (RPM and DEB based).Use theX binary package system' on Void LinuxBuild a .deb-file from the source tree usingmake deb.Build a .rpm-file from the source tree usingmake rpm.We appreciate packaging scripts for other distributions, please file a pull
request if you write one.If you preferpipover your package manager, you can install autorandr with:sudo pip install "git+http://github.com/phillipberndt/autorandr#egg=autorandr"or simplysudo pip install autorandrif you prefer to use a stable version.How to useSave your current display configuration and setup with:autorandr --save mobileConnect an additional display, configure your setup and save it:autorandr --save dockedNow autorandr can detect which hardware setup is active:$ autorandr
  mobile
  docked (detected)To automatically reload your setup:$ autorandr --changeTo manually load a profile:$ autorandr --load <profile>or simply:$ autorandr <profile>autorandr tries to avoid reloading an identical configuration. To force the
(re)configuration:$ autorandr --load <profile> --forceTo prevent a profile from being loaded, place a script callblockin its
directory. The script is evaluated before the screen setup is inspected, and
in case of it returning a value of 0 the profile is skipped. This can be used
to query the status of a docking station you are about to leave.If no suitable profile can be identified, the current configuration is kept.
To change this behaviour and switch to a fallback configuration, specify--default <profile>. The system-wide installation of autorandr by default
calls autorandr with a parameter--default default. There are three special,
virtual configurations calledhorizontal,verticalandcommon. They
automatically generate a configuration that incorporates all screens
connected to the computer. You can symlinkdefaultto one of these
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 located at~/.config/autorandr/settings.ini. In aconfigsection, you may place any
default values in the formoption-name=option-argument.A common and effective use of this is to specify defaultskip-options, for
instance skipping thegammasetting if usingredshiftas a daemon.  To implement
the equivalent of--skip-options gamma, yoursettings.inifile should look
like this:[config]
skip-options=gammaAdvanced usageHook scriptsThree more scripts can be placed in the configuration directory
(as defined by theXDG spec,
usually~/.config/autorandror~/.autorandrif you have an old installation
for user configuration and/etc/xdg/autorandrfor system wide configuration):postswitchis executedaftera mode switch has taken place. This can be
used to notify window managers or other applications about the switch.preswitchis executedbeforea mode switch takes place.postsaveis executed after a profile was stored or altered.predetectis executed before autorandr attempts to run xrandr.These scripts must be executable and can be placed directly in the configuration
directory, where they will always be executed, or in the profile subdirectories,
where they will only be executed on changes regarding that specific profile.Instead (or in addition) to these scripts, you can also place as many executable
files as you like in subdirectories calledscript_name.d(e.g.postswitch.d).
The order of execution of scripts in these directories is by file name, you can
force a certain ordering by naming them10-wallpaper,20-restart-wm, etc.If a script with the same name occurs multiple times, user configuration
takes precedence over system configuration (as specified by theXDG spec)
and profile configuration over general configuration.As a concrete example, suppose you have the files/etc/xdg/autorandr/postswitch~/.config/autorandr/postswitch~/.config/autorandr/postswitch.d/notify-herbstluftwm~/.config/autorandr/docked/postswitchand switch frommobiletodocked. Then~/.config/autorandr/docked/postswitchis executed, since the profile specific
configuration takes precedence, and~/.config/autorandr/postswitch.d/notify-herbstluftwmis executed, since
it has a unique name.If you switch back fromdockedtomobile,~/.config/autorandr/postswitchis executed instead of thedockedspecificpostswitch.If you experience issues with xrandr being executed too early after connecting
a new monitor, then you can use apredetectscript to delay the execution.
Write e.g.sleep 1into that file to make autorandr wait a second before
runningxrandr.VariablesSome of autorandr's state is exposed as environment variables
prefixed withAUTORANDR_, such as:AUTORANDR_CURRENT_PROFILEAUTORANDR_CURRENT_PROFILESAUTORANDR_PROFILE_FOLDERAUTORANDR_MONITORSwith 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 apostswitchscript:notify-send-idisplay"Display profile""$AUTORANDR_CURRENT_PROFILE"The one kink is that duringpreswitch,AUTORANDR_CURRENT_PROFILEis
reporting theupcomingprofile rather than thecurrentone.Wildcard EDID matchingThe EDID strings in the~/.config/autorandr/*/setupfiles may contain an
asterisk to enable wildcard matching: Such EDIDs are matched against connected
monitors using the usual file name globbing rules. This can be used to create
profiles matching multiple (or any) monitors.udev triggers with NVidia cardsIn order forudevto detectdrmevents from the native NVidia driver, the
kernel parameternvidia-drm.modesetmust be set to 1. For example, add a file/etc/modprobe.d/nvidia-drm-modeset.conf:options nvidia_drm modeset=1WaylandBefore running autorandr will check the environment for theWAYLAND_DISPLAYvariable to check if the program is running in a Wayland session. This is to
avoid issues between usage of xrandr in Wayland environments.If you need to run autorandr in a Wayland environment, one workaround is to
unset theWAYLAND_DISPLAYvariable before running the program, such as:WAYLAND_DISPLAY= autorandrChangelogautorandr 1.142023-06-22Direct --match-edid renaming of output messages to stderr2023-06-22Add Wayland awareness2023-06-22Various minor auxiliary tooling bug fixes, see git-logautorandr 1.13.32023-01-24Revert udev rule to rely on "change" event (see #324)autorandr 1.13.22023-01-23Fix autostart in KDE (see #320)2023-01-23Match add/remove rather than change in udev rule (see #321)2023-01-23Fix wildcard use in EDIDs (see #322)2023-01-23Do a final xrandr call to set the frame buffer size (see #319)autorandr 1.13.12023-01-16Fix bug with Version comparisonautorandr 1.132023-01-15Add reversed horizontal/vertical profiles2023-01-15Fix distutils deprecation warning2023-01-15Print error when user script fails2022-12-01Support--skip-options setto skip setting propertiesautorandr 1.12.12021-12-22Fix--match-edid(see #273)autorandr 1.122021-12-16Switch default interpreter to Python 32021-12-16Add--listto list all profiles2021-12-16Add--cycleto cycle all detected profiles2021-12-16Store display properties (see #204)autorandr 1.112020-05-23Handle empty sys.executable2020-06-08Fix Python 2 compatibility2020-10-06Set group membership of users in batch modeautorandr 1.10.12020-05-04Revert making the launcher the default (fixes #195)autorandr 1.102020-04-23Fix hook script execution order to match description from readme2020-04-11Handle negative gamma values (fixes #188)2020-04-11Sort approximate matches in detected profiles by quality of match2020-01-31Handle non-ASCII environment variables (fixes #180)2019-12-31Fix output positioning if the top-left output is not the first2019-12-31Accept negative gamma values (and interpret them as 0)2019-12-31Prefer the X11 launcher over systemd/udev configurationautorandr 1.92019-11-10Count closed lids as disconnected outputs2019-10-05Do not overwrite existing configurations without--force2019-08-16Accept modes that don't match the WWWxHHH pattern2019-03-22Improve bash autocompletion2019-03-21Store CRTC values in configurations2019-03-24Fix handling of recently disconnected outputs (See #128 and #143)autorandr 1.8.12019-03-18Removed mandb call from Makefileautorandr 1.82019-02-17Add an X11 daemon that runs autorandr when a display connects (by @rliou92, #127)2019-02-17Replace width=0 check with disconnected to detect disconnected monitors (by @joseph-jones, #139)2019-02-17Fix handling of empty padding (by @jschwab, #138)2019-02-17Add a man page (by @somers-all-the-time, #133)autorandr 1.72018-09-25Fix FB size computation with rotated screens (by @Janno, #117)autorandr 1.62018-04-19Bugfix: Do not load default profile unless --change is set2018-04-30Added aAUTORANDR_MONITORSvariable to hooks (by @bricewge, #106)2018-06-29Fix detection of current configuration if extra monitors are active2018-07-11Bugfix in the latest change: Correctly handle "off" minitors when comparing2018-07-19Do not kill spawned user processes from systemd unit2018-07-20Correctly handle "off" monitors when comparing -- fixup for another bug.autorandr 1.52018-01-03Add --version2018-01-04Fixed vertical/horizontal/clone-largest virtual profiles2018-03-07Output all non-error messages to stdout instead of stderr2018-03-25Add --detected and --current to filter the profile list output2018-03-25Allow wildcard matching in EDIDsautorandr 1.42017-12-22Fixed broken virtual profile support2017-12-14Added support for a settings file2017-12-14Added a virtual profileoff, which disables all screensautorandr 1.32017-11-13Add a short form for--load2017-11-21Fix environment stealing in--batchmode (See #87)autorandr 1.22017-07-16Skip--panningunless it is required (See #72)2017-10-13Addclone-largestvirtual profileautorandr 1.12017-06-07Call systemctl with--no-blockfrom udev rule (See #61)2017-01-20New script hook,predetect2017-01-18Accept comments (lines starting with#) in config/setup filesautorandr 1.02016-12-07Tag the current code as version 1.0.0; see github issue #542016-10-03Install a desktop file to/etc/xdg/autostartby default