Screen profiles manager for X.
It allows to store current screen setup in a declarative configuration file (a profile) and apply stored settings later
with a simple command.
Tool may be useful to people who work on their laptop connecting external displays in many different locations.
Usage is very simple:
0. Setup your screen to suit your needs (randrctl does not handle that)
1. Dump settings with randrctl to a named profile
```randrctl dump -e home```
2. Re-apply those settings, whenever you need them
```randrctl switch-to home```
3. ... or let randrctl to inspect currently connected displays and choose profile that fits them best
Auto-switching will also happen automatically if provided udev rules are installed to the system.
4. For more info on usage refer to help
## Auto-switching<a name="auto"></a>
```randrctl``` can associate profile with currently connected displays and switch to this profile automatically whenever
same (or similar) set of displays is connected.
Profile is matched to the set of connected displays by evaluating one or more of the following rules for every connected
* list of supported modes of connected display includes the current mode
```randrctl dump -m profile1```
You can use this to create profile that is activated whenever connected display supports the mode that is currently
set for that output.
* preferred mode of connected display is the current mode
```randrctl dump -p profile2```
Display can support wide range of modes from 640x480 to 1920x1200, but prefer only one of those. When dumped this way,
profile is considered a match if connected display prefers the mode, that is currently set for it.
* unique identifier of connected display is exactly tha same
```randrctl dump -e profile3```
Unique identifier (edid) of every display is dumped with the profile, so it matches, only if exactly same displays
Naturally, the more specific the rule, the bigger weight it has, so in case if you invoked those 3 dump commands above
with the same displays connected, `profile3` will be chosen as the best (i.e. the most specific) match.
It is possible to specify any combination of `-m -p -e` keys to dump command. In this case randrctl will try to match
all the rules combining them with logical AND (for example, display must support and at the same time prefer the mode).
Although such combination of rules might seem redundant (because if the more specific rule matches, the more generic
will do too), it might have sense if rule is edited manually.
If `randrctl dump` is invoked without additional options, it dumps only screen setup, so profile won't be considered
## Prior/Post hooks
randrctl can execute custom commands (hooks) before and after switching to profile or if switching fails. Hooks are
specified in config file `$XDG_CONFIG_HOME/randrctl/config.ini`
prior_switch = /usr/bin/killall -SIGSTOP i3
post_switch = /usr/bin/killall -SIGCONT i3 && /usr/bin/notify-send -u low "randrctl" "switched to $randr_profile"
post_fail = /usr/bin/killall -SIGCONT i3 && /usr/bin/notify-send -u critical "randrctl error" "$randr_error"
The typical use-case of this is displaying desktop notification with libnotify.
I also use it to pause i3 window manager as it was known to crash sometimes during the switch.
## Profile format
Profile is a simple text file in JSON format. It can be edited manually, however it is rarely required in practice
because `randrctl dump` handles most common cases.
As in usual JSON all values are case-sensitive, white-spaces don't matter.
Profile is required to contain 2 sections (`outputs` and `primary`). That is what dumped when `randrctl dump` is invoked
without additional options.
The `match` section is optional and is dumped only when one of the auto-switching rules is specified.
Each property of `outputs` section references output as seen in xrandr (i.e. *DP1*, *HDMI2*, etc.). Meaning of the
properties is the same as in the xrandr utility.
`mode` is mandatory, the others may be omitted.
Name of the primary output as seen in xrandr.
Set of rules for auto-switching.
The minimum rule is
which means, that something must be connected to that output.
Rule corresponding to `randrctl dump -m` would be
`randrctl dump -p` is
and `randrctl dump -e` is
`edid` is md5 hash of actual display's `edid`. To obtain that value, use `randrctl show`.
As was mentioned, `prefers`, `supports` and `edid` can be combined in the same rule, so it is possible to manually
create a more sophisticated rule
There is AUR package https://aur.archlinux.org/packages/randrctl-git/
# pip install randrctl
###Manual from sources
$ git clone https://github.com/edio/randrctl.git
$ cd randrctl
$ cp -r etc/randrctl ~/.config
# python setup.py install
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.