11 %define use_pm_utils 0
20 Summary: Automatically select a display configuration based on connected devices
23 Release: %{release}%{?dist}
24 Source0: https://github.com/phillipberndt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
26 Group: Development/Libraries
27 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
30 Vendor: Phillip Berndt <phillip.berndt@googlemail.com>
31 Url: https://github.com/phillipberndt/autorandr
32 Requires: python%{py_ver}
37 BuildRequires: bash-completion
38 BuildRequires: python%{py_ver}-devel
39 BuildRequires: systemd
45 Automatically select a display configuration based on connected devices
49 This is a compatible Python rewrite of
50 [wertarbyte/autorandr](https://github.com/wertarbyte/autorandr). Contributions
51 for bash-completion, fd.o/XDG autostart, Nitrogen, pm-utils, and systemd can be
52 found under [contrib](contrib/).
54 The original [wertarbyte/autorandr](https://github.com/wertarbyte/autorandr)
55 tree is unmaintained, with lots of open pull requests and issues. I forked it
56 and merged what I thought were the most important changes. If you are searching
57 for that version, see the [`legacy` branch](https://github.com/phillipberndt/autorandr/tree/legacy).
58 Note that the Python version is better suited for non-standard configurations,
59 like if you use `--transform` or `--reflect`. If you use `auto-disper`, you
60 have to use the bash version, as there is no disper support in the Python
61 version (yet). Both versions use a compatible configuration file format, so
62 you can, to some extent, switch between them. I will maintain the `legacy`
63 branch until @wertarbyte finds the time to maintain his branch again.
65 If you are interested in why there are two versions around, see
66 [#7](https://github.com/phillipberndt/autorandr/issues/7),
67 [#8](https://github.com/phillipberndt/autorandr/issues/8) and
69 [#12](https://github.com/phillipberndt/autorandr/issues/12)
70 if you are unhappy with this version and would like to contribute to the bash
73 ## License information and authors
75 autorandr is available under the terms of the GNU General Public License
78 Contributors to this version of autorandr are:
86 * Christophe-Marie Duquesne
93 * Rasmus Wriedt Larsen
104 ## Installation/removal
106 You can use the `autorandr.py` script as a stand-alone binary. If you'd like to
107 install it as a system-wide application, there is a Makefile included that also
108 places some configuration files in appropriate directories such that autorandr
109 is invoked automatically when a monitor is connected or removed, the system
110 wakes up from suspend, or a user logs into an X11 session. Run `make install`
111 as root to install it.
113 If you prefer to have a system wide install managed by your package manager,
116 * Use the [official Arch package](https://www.archlinux.org/packages/community/any/autorandr/).
117 * Use the [official Debian package](https://packages.debian.org/sid/x11/autorandr) on sid
118 * Use the [ebuild from zugaina](https://gpo.zugaina.org/x11-misc/autorandr) on Gentoo.
120 [nix package](https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/autorandr.nix)
122 * Use the automated nightlies generated by the
123 [openSUSE build service](https://build.opensuse.org/package/show/home:phillipberndt/autorandr)
124 for various distributions (RPM and DEB based).
125 * Use the [X binary package system](https://wiki.voidlinux.eu/XBPS)' on Void Linux
126 * Build a .deb-file from the source tree using `make deb`.
127 * Build a .rpm-file from the source tree using `make rpm`.
129 We appreciate packaging scripts for other distributions, please file a pull
130 request if you write one.
132 If you prefer `pip` over your package manager, you can install autorandr with:
134 sudo pip install "git+http://github.com/phillipberndt/autorandr#egg=autorandr"
138 sudo pip install autorandr
140 if you prefer to use a stable version.
144 Save your current display configuration and setup with:
146 autorandr --save mobile
148 Connect an additional display, configure your setup and save it:
150 autorandr --save docked
152 Now autorandr can detect which hardware setup is active:
158 To automatically reload your setup:
162 To manually load a profile:
164 $ autorandr --load <profile>
168 $ autorandr <profile>
170 autorandr tries to avoid reloading an identical configuration. To force the
173 $ autorandr --load <profile> --force
175 To prevent a profile from being loaded, place a script call _block_ in its
176 directory. The script is evaluated before the screen setup is inspected, and
177 in case of it returning a value of 0 the profile is skipped. This can be used
178 to query the status of a docking station you are about to leave.
180 If no suitable profile can be identified, the current configuration is kept.
181 To change this behaviour and switch to a fallback configuration, specify
182 `--default <profile>`. The system-wide installation of autorandr by default
183 calls autorandr with a parameter `--default default`. There are three special,
184 virtual configurations called `horizontal`, `vertical` and `common`. They
185 automatically generate a configuration that incorporates all screens
186 connected to the computer. You can symlink `default` to one of these
187 names in your configuration directory to have autorandr use any of them
188 as the default configuration without you having to change the system-wide
191 You can store default values for any option in an INI-file in
192 `~/.config/autorandr/settings.ini` in a section `config`. The most useful
193 candidate for doing that is `skip-options`, if you need it.
199 Three more scripts can be placed in the configuration directory
200 (as defined by the [XDG spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html),
201 usually `~/.config/autorandr` or `~/.autorandr` if you have an old installation
202 for user configuration and `/etc/xdg/autorandr` for system wide configuration):
204 - `postswitch` is executed *after* a mode switch has taken place. This can be
205 used to notify window managers or other applications about the switch.
206 - `preswitch` is executed *before* a mode switch takes place.
207 - `postsave` is executed after a profile was stored or altered.
208 - `predetect` is executed before autorandr attempts to run xrandr.
210 These scripts must be executable and can be placed directly in the configuration
211 directory, where they will always be executed, or in the profile subdirectories,
212 where they will only be executed on changes regarding that specific profile.
214 Instead (or in addition) to these scripts, you can also place as many executable
215 files as you like in subdirectories called `script_name.d` (e.g. `postswitch.d`).
217 If a script with the same name occurs multiple times, user configuration
218 takes precedence over system configuration (as specified by the
219 [XDG spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html))
220 and profile configuration over general configuration.
222 As a concrete example, suppose you have the files
224 - `/etc/xdg/autorandr/postswitch`
225 - `~/.config/autorandr/postswitch`
226 - `~/.config/autorandr/postswitch.d/notify-herbstluftwm`
227 - `~/.config/autorandr/docked/postswitch`
229 and switch from `mobile` to `docked`. Then
230 `~/.config/autorandr/docked/postswitch` is executed, since the profile specific
231 configuration takes precedence, and
232 `~/.config/autorandr/postswitch.d/notify-herbstluftwm` is executed, since
233 it has a unique name.
235 If you switch back from `docked` to `mobile`, `~/.config/autorandr/postswitch`
236 is executed instead of the `docked` specific `postswitch`.
238 In these scripts, some of autorandr's state is exposed as environment variables
239 prefixed with `AUTORANDR_`, such as:
240 - `AUTORANDR_CURRENT_PROFILE`
241 - `AUTORANDR_CURRENT_PROFILES`
242 - `AUTORANDR_PROFILE_FOLDER`
243 - `AUTORANDR_MONITORS`
245 If you experience issues with xrandr being executed too early after connecting
246 a new monitor, then you can use a `predetect` script to delay the execution.
247 Write e.g. `sleep 1` into that file to make autorandr wait a second before
250 ### Wildcard EDID matching
252 The EDID strings in the `~/.config/autorandr/*/setup` files may contain an
253 asterisk to enable wildcard matching: Such EDIDs are matched against connected
254 monitors using the usual file name globbing rules. This can be used to create
255 profiles matching multiple (or any) monitors.
260 * *2020-05-04* Revert making the launcher the default (fixes #195)
263 * *2020-04-23* Fix hook script execution order to match description from readme
264 * *2020-04-11* Handle negative gamma values (fixes #188)
265 * *2020-04-11* Sort approximate matches in detected profiles by quality of match
266 * *2020-01-31* Handle non-ASCII environment variables (fixes #180)
267 * *2019-12-31* Fix output positioning if the top-left output is not the first
268 * *2019-12-31* Accept negative gamma values (and interpret them as 0)
269 * *2019-12-31* Prefer the X11 launcher over systemd/udev configuration
273 * *2019-11-10* Count closed lids as disconnected outputs
274 * *2019-10-05* Do not overwrite existing configurations without `--force`
275 * *2019-08-16* Accept modes that don't match the WWWxHHH pattern
276 * *2019-03-22* Improve bash autocompletion
277 * *2019-03-21* Store CRTC values in configurations
278 * *2019-03-24* Fix handling of recently disconnected outputs (See #128 and #143)
282 * *2019-03-18* Removed mandb call from Makefile
286 * *2019-02-17* Add an X11 daemon that runs autorandr when a display connects (by @rliou92, #127)
287 * *2019-02-17* Replace width=0 check with disconnected to detect disconnected monitors (by @joseph-jones, #139)
288 * *2019-02-17* Fix handling of empty padding (by @jschwab, #138)
289 * *2019-02-17* Add a man page (by @somers-all-the-time, #133)
293 * *2018-09-25* Fix FB size computation with rotated screens (by @Janno, #117)
297 * *2018-04-19* Bugfix: Do not load default profile unless --change is set
298 * *2018-04-30* Added a `AUTORANDR_MONITORS` variable to hooks (by @bricewge, #106)
299 * *2018-06-29* Fix detection of current configuration if extra monitors are active
300 * *2018-07-11* Bugfix in the latest change: Correctly handle "off" minitors when comparing
301 * *2018-07-19* Do not kill spawned user processes from systemd unit
302 * *2018-07-20* Correctly handle "off" monitors when comparing -- fixup for another bug.
306 * *2018-01-03* Add --version
307 * *2018-01-04* Fixed vertical/horizontal/clone-largest virtual profiles
308 * *2018-03-07* Output all non-error messages to stdout instead of stderr
309 * *2018-03-25* Add --detected and --current to filter the profile list output
310 * *2018-03-25* Allow wildcard matching in EDIDs
314 * *2017-12-22* Fixed broken virtual profile support
315 * *2017-12-14* Added support for a settings file
316 * *2017-12-14* Added a virtual profile `off`, which disables all screens
320 * *2017-11-13* Add a short form for `--load`
321 * *2017-11-21* Fix environment stealing in `--batch` mode (See #87)
325 * *2017-07-16* Skip `--panning` unless it is required (See #72)
326 * *2017-10-13* Add `clone-largest` virtual profile
330 * *2017-06-07* Call systemctl with `--no-block` from udev rule (See #61)
331 * *2017-01-20* New script hook, `predetect`
332 * *2017-01-18* Accept comments (lines starting with `#`) in config/setup files
336 * *2016-12-07* Tag the current code as version 1.0.0; see github issue #54
337 * *2016-10-03* Install a desktop file to `/etc/xdg/autostart` by default
339 %package zsh-completion
340 Summary: zsh-completion for autorandr
343 %description zsh-completion
344 This package provides zsh-completion files for autorandr
347 %setup -n %{name}-%{version} -n %{name}-%{version}
349 pathfix.py -pni "%{__python3} %{py3_shbang_opts}" ./autorandr.py
351 pathfix.py -pni "%{__python2} %{py2_shbang_opts}" ./autorandr.py
355 make DESTDIR="%{buildroot}" PREFIX=/usr install
356 install -vDm 644 README.md -t "%{buildroot}/usr/share/doc/%{name}/"
357 install -vDm 644 contrib/zsh_completion/_autorandr -t %{buildroot}%{_datarootdir}/zsh/site-functions/
361 %defattr(-,root,root,-)
362 %attr(0644,root,root) %{_unitdir}/autorandr.service
365 %config(noreplace) %{_sysconfdir}/*
368 %{_datarootdir}/bash-completion/completions/autorandr
369 %{_udevrulesdir}/40-monitor-hotplug.rules
371 %files zsh-completion
372 %{_datarootdir}/zsh/site-functions/_autorandr
375 * Mon Jun 08 2020 Jerzy Drozdz <jerzy.drozdz@jdsieci.pl> - 1.10.1-1
376 - Updated to stable 1.10.1
377 - Added zsh-completion subpackage
378 * Wed May 22 2019 Maciej Sitarz <macieksitarz@wp.pl> - 1.8.1-1
379 - Updated to stable 1.8.1
380 * Fri Sep 28 2018 Maciej Sitarz <macieksitarz@wp.pl> - 1.7-1
381 - Updated to stable 1.7
382 * Thu Jul 19 2018 Maciej Sitarz <macieksitarz@wp.pl> - 1.5-1
383 - Updated to stable 1.5
384 - Changed dest path for systemd service file
385 * Sun Oct 01 2017 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 1.1-2
386 - Added conditionals for pm-utils, compability with Fedora26+
387 - Removed bash-completion from requisites
388 - Removed udev from requisites
389 * Sun Sep 03 2017 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 1.1-1
390 - Update to stable 1.1
391 * Fri Feb 17 2017 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 20170217git-1
393 * Wed Jul 6 2016 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 20160706git-1
394 - Set default value of $XDG_CONFIG_DIRS to fulfill the standard
395 * Fri Jul 1 2016 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 20160701git-1.1
396 - fixed running udevadm in post
397 * Fri Jul 1 2016 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 20160701git-1