]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/blob - contrib/packaging/rpm/autorandr.spec
Refactor: merge --change and --cycle handling
[deb_pkgs/autorandr.git] / contrib / packaging / rpm / autorandr.spec
1 %define name autorandr
2 %define version 1.10.1
3 %define release 1
4
5 # pmutils
6 %define use_pm_utils 1
7 %if 0%{?fedora} > 22
8 %define use_pm_utils 0
9 %endif
10 %if 0%{?rhel} > 7
11 %define use_pm_utils 0
12 %endif
13
14 # python 2 or 3
15 %define py_ver 3
16 %if 0%{?rhel}
17 %define py_ver 2
18 %endif
19
20 Summary: Automatically select a display configuration based on connected devices
21 Name: %{name}
22 Version: %{version}
23 Release: %{release}%{?dist}
24 Source0: https://github.com/phillipberndt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
25 License: GPLv3
26 Group: Development/Libraries
27 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
28 Prefix: %{_prefix}
29 BuildArch: noarch
30 Vendor: Phillip Berndt <phillip.berndt@googlemail.com>
31 Url: https://github.com/phillipberndt/autorandr
32 Requires: python%{py_ver}
33 %if 0%{?use_pm_utils}
34 Requires:       pm-utils
35 %endif
36 %{?systemd_ordering}
37 BuildRequires: bash-completion
38 BuildRequires: python%{py_ver}-devel
39 BuildRequires: systemd
40 BuildRequires: udev
41 %if %{py_ver} == 2
42 BuildRequires: python3-devel
43 %endif
44
45
46 %description
47 # autorandr
48
49 Automatically select a display configuration based on connected devices
50
51 ## Branch information
52
53 This is a compatible Python rewrite of
54 [wertarbyte/autorandr](https://github.com/wertarbyte/autorandr). Contributions
55 for bash-completion, fd.o/XDG autostart, Nitrogen, pm-utils, and systemd can be
56 found under [contrib](contrib/).
57
58 The original [wertarbyte/autorandr](https://github.com/wertarbyte/autorandr)
59 tree is unmaintained, with lots of open pull requests and issues. I forked it
60 and merged what I thought were the most important changes. If you are searching
61 for that version, see the [`legacy` branch](https://github.com/phillipberndt/autorandr/tree/legacy).
62 Note that the Python version is better suited for non-standard configurations,
63 like if you use `--transform` or `--reflect`. If you use `auto-disper`, you
64 have to use the bash version, as there is no disper support in the Python
65 version (yet). Both versions use a compatible configuration file format, so
66 you can, to some extent, switch between them.  I will maintain the `legacy`
67 branch until @wertarbyte finds the time to maintain his branch again.
68
69 If you are interested in why there are two versions around, see
70 [#7](https://github.com/phillipberndt/autorandr/issues/7),
71 [#8](https://github.com/phillipberndt/autorandr/issues/8) and
72 especially
73 [#12](https://github.com/phillipberndt/autorandr/issues/12)
74 if you are unhappy with this version and would like to contribute to the bash
75 version.
76
77 ## License information and authors
78
79 autorandr is available under the terms of the GNU General Public License
80 (version 3).
81
82 Contributors to this version of autorandr are:
83
84 * Adrián López
85 * andersonjacob
86 * Alexander Wirt
87 * Brice Waegeneire
88 * Chris Dunder
89 * Christoph Gysin
90 * Christophe-Marie Duquesne
91 * Daniel Hahler
92 * Maciej Sitarz
93 * Mathias Svensson
94 * Matthew R Johnson
95 * Nazar Mokrynskyi
96 * Phillip Berndt
97 * Rasmus Wriedt Larsen
98 * Simon Wydooghe
99 * Stefan Tomanek
100 * stormc
101 * tachylatus
102 * Timo Bingmann
103 * Timo Kaufmann
104 * Tomasz Bogdal
105 * Victor Häggqvist
106 * Jan-Oliver Kaiser
107
108 ## Installation/removal
109
110 You can use the `autorandr.py` script as a stand-alone binary. If you'd like to
111 install it as a system-wide application, there is a Makefile included that also
112 places some configuration files in appropriate directories such that autorandr
113 is invoked automatically when a monitor is connected or removed, the system
114 wakes up from suspend, or a user logs into an X11 session. Run `make install`
115 as root to install it.
116
117 If you prefer to have a system wide install managed by your package manager,
118 you can
119
120 * Use the [official Arch package](https://www.archlinux.org/packages/community/any/autorandr/).
121 * Use the [official Debian package](https://packages.debian.org/sid/x11/autorandr) on sid
122 * Use the [ebuild from zugaina](https://gpo.zugaina.org/x11-misc/autorandr) on Gentoo.
123 * Use the
124   [nix package](https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/autorandr.nix)
125   on NixOS.
126 * Use the automated nightlies generated by the
127   [openSUSE build service](https://build.opensuse.org/package/show/home:phillipberndt/autorandr)
128   for various distributions (RPM and DEB based).
129 * Use the [X binary package system](https://wiki.voidlinux.eu/XBPS)' on Void Linux 
130 * Build a .deb-file from the source tree using `make deb`.
131 * Build a .rpm-file from the source tree using `make rpm`.
132
133 We appreciate packaging scripts for other distributions, please file a pull
134 request if you write one.
135
136 If you prefer `pip` over your package manager, you can install autorandr with:
137
138     sudo pip install "git+http://github.com/phillipberndt/autorandr#egg=autorandr"
139
140 or simply
141
142     sudo pip install autorandr
143
144 if you prefer to use a stable version.
145
146 ## How to use
147
148 Save your current display configuration and setup with:
149
150     autorandr --save mobile
151
152 Connect an additional display, configure your setup and save it:
153
154     autorandr --save docked
155
156 Now autorandr can detect which hardware setup is active:
157
158     $ autorandr
159       mobile
160       docked (detected)
161
162 To automatically reload your setup:
163
164     $ autorandr --change
165
166 To manually load a profile:
167
168     $ autorandr --load <profile>
169
170 or simply:
171
172     $ autorandr <profile>
173
174 autorandr tries to avoid reloading an identical configuration. To force the
175 (re)configuration:
176
177     $ autorandr --load <profile> --force
178
179 To prevent a profile from being loaded, place a script call _block_ in its
180 directory. The script is evaluated before the screen setup is inspected, and
181 in case of it returning a value of 0 the profile is skipped. This can be used
182 to query the status of a docking station you are about to leave.
183
184 If no suitable profile can be identified, the current configuration is kept.
185 To change this behaviour and switch to a fallback configuration, specify
186 `--default <profile>`. The system-wide installation of autorandr by default
187 calls autorandr with a parameter `--default default`. There are three special,
188 virtual configurations called `horizontal`, `vertical` and `common`. They
189 automatically generate a configuration that incorporates all screens
190 connected to the computer. You can symlink `default` to one of these
191 names in your configuration directory to have autorandr use any of them
192 as the default configuration without you having to change the system-wide
193 configuration.
194
195 You can store default values for any option in an INI-file in
196 `~/.config/autorandr/settings.ini` in a section `config`. The most useful
197 candidate for doing that is `skip-options`, if you need it.
198
199 ## Advanced usage
200
201 ### Hook scripts
202
203 Three more scripts can be placed in the configuration directory
204 (as defined by the [XDG spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html),
205 usually `~/.config/autorandr` or `~/.autorandr` if you have an old installation
206 for user configuration and `/etc/xdg/autorandr` for system wide configuration):
207
208 - `postswitch` is executed *after* a mode switch has taken place. This can be
209   used to notify window managers or other applications about the switch.
210 - `preswitch` is executed *before* a mode switch takes place.
211 - `postsave` is executed after a profile was stored or altered.
212 - `predetect` is executed before autorandr attempts to run xrandr. 
213
214 These scripts must be executable and can be placed directly in the configuration
215 directory, where they will always be executed, or in the profile subdirectories,
216 where they will only be executed on changes regarding that specific profile.
217
218 Instead (or in addition) to these scripts, you can also place as many executable
219 files as you like in subdirectories called `script_name.d` (e.g. `postswitch.d`).
220
221 If a script with the same name occurs multiple times, user configuration
222 takes precedence over system configuration (as specified by the
223 [XDG spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html))
224 and profile configuration over general configuration.
225
226 As a concrete example, suppose you have the files
227
228 - `/etc/xdg/autorandr/postswitch`
229 - `~/.config/autorandr/postswitch`
230 - `~/.config/autorandr/postswitch.d/notify-herbstluftwm`
231 - `~/.config/autorandr/docked/postswitch`
232
233 and switch from `mobile` to `docked`. Then
234 `~/.config/autorandr/docked/postswitch` is executed, since the profile specific
235 configuration takes precedence, and
236 `~/.config/autorandr/postswitch.d/notify-herbstluftwm` is executed, since
237 it has a unique name.
238
239 If you switch back from `docked` to `mobile`, `~/.config/autorandr/postswitch`
240 is executed instead of the `docked` specific `postswitch`.
241
242 If you experience issues with xrandr being executed too early after connecting
243 a new monitor, then you can use a `predetect` script to delay the execution.
244 Write e.g. `sleep 1` into that file to make autorandr wait a second before
245 running `xrandr`.
246
247 #### Variables
248
249 Some of autorandr's state is exposed as environment variables
250 prefixed with `AUTORANDR_`, such as:
251 - `AUTORANDR_CURRENT_PROFILE`
252 - `AUTORANDR_CURRENT_PROFILES`
253 - `AUTORANDR_PROFILE_FOLDER`
254 - `AUTORANDR_MONITORS`
255
256 with the intention that they can be used within the hook scripts.
257
258 For instance, you might display which profile has just been activated by
259 including the following in a `postswitch` script:
260 ```sh
261 notify-send -i display "Display profile" "$AUTORANDR_CURRENT_PROFILE"
262 ```
263
264 The one kink is that during `preswitch`, `AUTORANDR_CURRENT_PROFILE` is
265 reporting the *upcoming* profile rather than the *current* one.
266
267 ### Wildcard EDID matching
268
269 The EDID strings in the `~/.config/autorandr/*/setup` files may contain an
270 asterisk to enable wildcard matching: Such EDIDs are matched against connected
271 monitors using the usual file name globbing rules. This can be used to create
272 profiles matching multiple (or any) monitors.
273
274 ## Changelog
275
276 **autorandr 1.10.1**
277 * *2020-05-04* Revert making the launcher the default (fixes #195)
278
279 **autorandr 1.10**
280 * *2020-04-23* Fix hook script execution order to match description from readme
281 * *2020-04-11* Handle negative gamma values (fixes #188)
282 * *2020-04-11* Sort approximate matches in detected profiles by quality of match
283 * *2020-01-31* Handle non-ASCII environment variables (fixes #180)
284 * *2019-12-31* Fix output positioning if the top-left output is not the first
285 * *2019-12-31* Accept negative gamma values (and interpret them as 0)
286 * *2019-12-31* Prefer the X11 launcher over systemd/udev configuration
287
288 **autorandr 1.9**
289
290 * *2019-11-10* Count closed lids as disconnected outputs
291 * *2019-10-05* Do not overwrite existing configurations without `--force`
292 * *2019-08-16* Accept modes that don't match the WWWxHHH pattern
293 * *2019-03-22* Improve bash autocompletion
294 * *2019-03-21* Store CRTC values in configurations
295 * *2019-03-24* Fix handling of recently disconnected outputs (See #128 and #143)
296
297 **autorandr 1.8.1**
298
299 * *2019-03-18* Removed mandb call from Makefile
300
301 **autorandr 1.8**
302
303 * *2019-02-17* Add an X11 daemon that runs autorandr when a display connects (by @rliou92, #127)
304 * *2019-02-17* Replace width=0 check with disconnected to detect disconnected monitors (by @joseph-jones, #139)
305 * *2019-02-17* Fix handling of empty padding (by @jschwab, #138)
306 * *2019-02-17* Add a man page (by @somers-all-the-time, #133)
307
308 **autorandr 1.7**
309
310 * *2018-09-25* Fix FB size computation with rotated screens (by @Janno, #117)
311
312 **autorandr 1.6**
313
314 * *2018-04-19* Bugfix: Do not load default profile unless --change is set
315 * *2018-04-30* Added a `AUTORANDR_MONITORS` variable to hooks (by @bricewge, #106)
316 * *2018-06-29* Fix detection of current configuration if extra monitors are active
317 * *2018-07-11* Bugfix in the latest change: Correctly handle "off" minitors when comparing
318 * *2018-07-19* Do not kill spawned user processes from systemd unit
319 * *2018-07-20* Correctly handle "off" monitors when comparing -- fixup for another bug.
320
321 **autorandr 1.5**
322
323 * *2018-01-03* Add --version
324 * *2018-01-04* Fixed vertical/horizontal/clone-largest virtual profiles
325 * *2018-03-07* Output all non-error messages to stdout instead of stderr
326 * *2018-03-25* Add --detected and --current to filter the profile list output
327 * *2018-03-25* Allow wildcard matching in EDIDs
328
329 **autorandr 1.4**
330
331 * *2017-12-22* Fixed broken virtual profile support
332 * *2017-12-14* Added support for a settings file
333 * *2017-12-14* Added a virtual profile `off`, which disables all screens
334
335 **autorandr 1.3**
336
337 * *2017-11-13* Add a short form for `--load`
338 * *2017-11-21* Fix environment stealing in `--batch` mode (See #87)
339
340 **autorandr 1.2**
341
342 * *2017-07-16* Skip `--panning` unless it is required (See #72)
343 * *2017-10-13* Add `clone-largest` virtual profile
344
345 **autorandr 1.1**
346
347 * *2017-06-07* Call systemctl with `--no-block` from udev rule (See #61)
348 * *2017-01-20* New script hook, `predetect`
349 * *2017-01-18* Accept comments (lines starting with `#`) in config/setup files
350
351 **autorandr 1.0**
352
353 * *2016-12-07* Tag the current code as version 1.0.0; see github issue #54
354 * *2016-10-03* Install a desktop file to `/etc/xdg/autostart` by default
355
356 %package zsh-completion
357 Summary: zsh-completion for autorandr
358 Requires: zsh
359 Requires: %{name}
360 %description zsh-completion
361 This package provides zsh-completion files for autorandr
362
363 %prep
364 %setup -n %{name}-%{version} -n %{name}-%{version}
365 %if %{py_ver} == 3
366 pathfix.py -pni "%{__python3} %{py3_shbang_opts}" ./autorandr.py
367 %else
368 pathfix.py -pni "%{__python2} %{py2_shbang_opts}" ./autorandr.py
369 %endif
370
371 %install
372 make DESTDIR="%{buildroot}" PREFIX=/usr install
373 install -vDm 644 README.md -t "%{buildroot}/usr/share/doc/%{name}/"
374 install -vDm 644 contrib/zsh_completion/_autorandr -t %{buildroot}%{_datarootdir}/zsh/site-functions/
375
376
377 %files
378 %defattr(-,root,root,-)
379 %attr(0644,root,root) %{_unitdir}/autorandr.service
380 %license gpl-3.0.txt 
381 %doc README.md
382 %config(noreplace) %{_sysconfdir}/*
383 %{_bindir}/*
384 %{_mandir}
385 %{_datarootdir}/bash-completion/completions/autorandr
386 %{_udevrulesdir}/40-monitor-hotplug.rules
387
388 %files zsh-completion
389 %{_datarootdir}/zsh/site-functions/_autorandr
390
391 %changelog
392 * Mon Jun 08 2020 Jerzy Drozdz <jerzy.drozdz@jdsieci.pl> - 1.10.1-1
393 - Updated to stable 1.10.1
394 - Added zsh-completion subpackage
395 * Wed May 22 2019 Maciej Sitarz <macieksitarz@wp.pl> - 1.8.1-1
396 - Updated to stable 1.8.1
397 * Fri Sep 28 2018 Maciej Sitarz <macieksitarz@wp.pl> - 1.7-1
398 - Updated to stable 1.7
399 * Thu Jul 19 2018 Maciej Sitarz <macieksitarz@wp.pl> - 1.5-1
400 - Updated to stable 1.5
401 - Changed dest path for systemd service file
402 * Sun Oct 01 2017 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 1.1-2
403 - Added conditionals for pm-utils, compability with Fedora26+
404 - Removed bash-completion from requisites
405 - Removed udev from requisites
406 * Sun Sep 03 2017 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 1.1-1
407 - Update to stable 1.1
408 * Fri Feb 17 2017 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 20170217git-1
409 - Update to master
410 * Wed Jul 6 2016 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 20160706git-1
411 - Set default value of $XDG_CONFIG_DIRS to fulfill the standard
412 * Fri Jul 1 2016 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 20160701git-1.1
413 - fixed running udevadm in post
414 * Fri Jul 1 2016 Jerzy Drozdz <rpmbuilder@jdsieci.pl> - 20160701git-1
415 - initial build