Coder Social home page Coder Social logo

phillipberndt / autorandr Goto Github PK

View Code? Open in Web Editor NEW
2.4K 22.0 117.0 574 KB

Auto-detect the connected display hardware and load the appropriate X11 setup using xrandr

Makefile 8.94% Shell 6.42% Python 75.80% C 4.10% Roff 4.74%
xrandr x11 configuration-management

autorandr's Introduction

autorandr

Automatically select a display configuration based on connected devices

Branch information

This is a compatible Python rewrite of wertarbyte/autorandr. Contributions for bash-completion, fd.o/XDG autostart, Nitrogen, pm-utils, and systemd can be found under contrib.

The original wertarbyte/autorandr tree 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 the legacy branch. Note that the Python version is better suited for non-standard configurations, like if you use --transform or --reflect. If you use auto-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 the legacy branch until @wertarbyte finds the time to maintain his branch again.

If you are interested in why there are two versions around, see #7, #8 and especially #12 if you are unhappy with this version and would like to contribute to the bash version.

License information and authors

autorandr is available under the terms of the GNU General Public License (version 3).

Contributors to this version of autorandr are:

  • Adrián López
  • andersonjacob
  • Alexander Lochmann
  • Alexander Wirt
  • Brice Waegeneire
  • Chris Dunder
  • Christoph Gysin
  • Christophe-Marie Duquesne
  • Daniel Hahler
  • Maciej Sitarz
  • Mathias Svensson
  • Matthew R Johnson
  • Nazar Mokrynskyi
  • Phillip Berndt
  • Rasmus Wriedt Larsen
  • Sam Coulter
  • Simon Wydooghe
  • Stefan Tomanek
  • stormc
  • tachylatus
  • Timo Bingmann
  • Timo Kaufmann
  • Tomasz Bogdal
  • Victor Häggqvist
  • Jan-Oliver Kaiser
  • Alexandre Viau

Installation/removal

You can use the autorandr.py script 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. Run make install as root to install it.

If you prefer to have a system wide install managed by your package manager, you can

We appreciate packaging scripts for other distributions, please file a pull request if you write one.

If you prefer pip over your package manager, you can install autorandr with:

sudo pip install "git+http://github.com/phillipberndt/autorandr#egg=autorandr"

or simply

sudo pip install autorandr

if you prefer to use a stable version.

How to use

Save your current display configuration and setup with:

autorandr --save mobile

Connect an additional display, configure your setup and save it:

autorandr --save docked

Now autorandr can detect which hardware setup is active:

$ autorandr
  mobile
  docked (detected)

To automatically reload your setup:

$ autorandr --change

To 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> --force

To prevent a profile from being loaded, place a script call block in 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 called horizontal, vertical and common. They automatically generate a configuration that incorporates all screens connected to the computer. You can symlink default to 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 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 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

Hook scripts

Three more scripts can be placed in the configuration directory (as defined by the XDG spec, usually ~/.config/autorandr or ~/.autorandr if you have an old installation for user configuration and /etc/xdg/autorandr for system wide configuration):

  • postswitch is executed after a mode switch has taken place. This can be used to notify window managers or other applications about the switch.
  • preswitch is executed before a mode switch takes place.
  • postsave is executed after a profile was stored or altered.
  • predetect is 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 called script_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 them 10-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 the XDG 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/postswitch

and switch from mobile to docked. Then ~/.config/autorandr/docked/postswitch is executed, since the profile specific configuration takes precedence, and ~/.config/autorandr/postswitch.d/notify-herbstluftwm is executed, since it has a unique name.

If you switch back from docked to mobile, ~/.config/autorandr/postswitch is executed instead of the docked specific postswitch.

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

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:

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

The EDID strings in the ~/.config/autorandr/*/setup files 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 cards

In order for udev to detect drm events from the native NVidia driver, the kernel parameter nvidia-drm.modeset must be set to 1. For example, add a file /etc/modprobe.d/nvidia-drm-modeset.conf:

options nvidia_drm modeset=1

Wayland

Before running autorandr will check the environment for the WAYLAND_DISPLAY variable 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 the WAYLAND_DISPLAY variable before running the program, such as:

WAYLAND_DISPLAY= autorandr

Changelog

autorandr 1.15

  • 2023-11-27 Several regex literal bug fixes
  • 2023-12-27 Fix #375: Listen to correct events in launcher
  • 2024-03-03 Fix #367: Skip profiles without outputs

autorandr 1.14

  • 2023-06-22 Direct --match-edid renaming of output messages to stderr
  • 2023-06-22 Add Wayland awareness
  • 2023-06-22 Various minor auxiliary tooling bug fixes, see git-log

autorandr 1.13.3

  • 2023-01-24 Revert udev rule to rely on "change" event (see #324)

autorandr 1.13.2

  • 2023-01-23 Fix autostart in KDE (see #320)
  • 2023-01-23 Match add/remove rather than change in udev rule (see #321)
  • 2023-01-23 Fix wildcard use in EDIDs (see #322)
  • 2023-01-23 Do a final xrandr call to set the frame buffer size (see #319)

autorandr 1.13.1

  • 2023-01-16 Fix bug with Version comparison

autorandr 1.13

  • 2023-01-15 Add reversed horizontal/vertical profiles
  • 2023-01-15 Fix distutils deprecation warning
  • 2023-01-15 Print error when user script fails
  • 2022-12-01 Support --skip-options set to skip setting properties

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
  • 2020-10-06 Set group membership of users in batch mode

autorandr 1.10.1

  • 2020-05-04 Revert making the launcher the default (fixes #195)

autorandr 1.10

  • 2020-04-23 Fix hook script execution order to match description from readme
  • 2020-04-11 Handle negative gamma values (fixes #188)
  • 2020-04-11 Sort approximate matches in detected profiles by quality of match
  • 2020-01-31 Handle non-ASCII environment variables (fixes #180)
  • 2019-12-31 Fix output positioning if the top-left output is not the first
  • 2019-12-31 Accept negative gamma values (and interpret them as 0)
  • 2019-12-31 Prefer the X11 launcher over systemd/udev configuration

autorandr 1.9

  • 2019-11-10 Count closed lids as disconnected outputs
  • 2019-10-05 Do not overwrite existing configurations without --force
  • 2019-08-16 Accept modes that don't match the WWWxHHH pattern
  • 2019-03-22 Improve bash autocompletion
  • 2019-03-21 Store CRTC values in configurations
  • 2019-03-24 Fix handling of recently disconnected outputs (See #128 and #143)

autorandr 1.8.1

  • 2019-03-18 Removed mandb call from Makefile

autorandr 1.8

  • 2019-02-17 Add an X11 daemon that runs autorandr when a display connects (by @rliou92, #127)
  • 2019-02-17 Replace width=0 check with disconnected to detect disconnected monitors (by @joseph-jones, #139)
  • 2019-02-17 Fix handling of empty padding (by @jschwab, #138)
  • 2019-02-17 Add a man page (by @somers-all-the-time, #133)

autorandr 1.7

  • 2018-09-25 Fix FB size computation with rotated screens (by @Janno, #117)

autorandr 1.6

  • 2018-04-19 Bugfix: Do not load default profile unless --change is set
  • 2018-04-30 Added a AUTORANDR_MONITORS variable to hooks (by @bricewge, #106)
  • 2018-06-29 Fix detection of current configuration if extra monitors are active
  • 2018-07-11 Bugfix in the latest change: Correctly handle "off" minitors when comparing
  • 2018-07-19 Do not kill spawned user processes from systemd unit
  • 2018-07-20 Correctly handle "off" monitors when comparing -- fixup for another bug.

autorandr 1.5

  • 2018-01-03 Add --version
  • 2018-01-04 Fixed vertical/horizontal/clone-largest virtual profiles
  • 2018-03-07 Output all non-error messages to stdout instead of stderr
  • 2018-03-25 Add --detected and --current to filter the profile list output
  • 2018-03-25 Allow wildcard matching in EDIDs

autorandr 1.4

  • 2017-12-22 Fixed broken virtual profile support
  • 2017-12-14 Added support for a settings file
  • 2017-12-14 Added a virtual profile off, which disables all screens

autorandr 1.3

  • 2017-11-13 Add a short form for --load
  • 2017-11-21 Fix environment stealing in --batch mode (See #87)

autorandr 1.2

  • 2017-07-16 Skip --panning unless it is required (See #72)
  • 2017-10-13 Add clone-largest virtual profile

autorandr 1.1

  • 2017-06-07 Call systemctl with --no-block from udev rule (See #61)
  • 2017-01-20 New script hook, predetect
  • 2017-01-18 Accept comments (lines starting with #) in config/setup files

autorandr 1.0

  • 2016-12-07 Tag the current code as version 1.0.0; see github issue #54
  • 2016-10-03 Install a desktop file to /etc/xdg/autostart by default

autorandr's People

Contributors

adrianlzt avatar aviau avatar bingmann avatar blueyed avatar chmduquesne avatar christophgysin avatar flowdalic avatar herm avatar horstmannmat avatar lkrms avatar maciej-sitarz-ibm avatar maciex avatar mikelward avatar nmschulte avatar paulharris avatar perrin4869 avatar phillipberndt avatar pngdeity avatar queezythegreat avatar rasmuswl avatar rliou92 avatar sayrus avatar t0fik avatar tachylatus avatar timokau avatar vincentbernat avatar vladimir-csp avatar voda avatar vuimuich avatar wertarbyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autorandr's Issues

systemd detection does not work on Arch Linux

I have noticed that HAVE_SYSTEMD=$(shell grep -q systemd /proc/1/cmdline && echo "y") from the Makefile does not work on Arch Linux, where it contains /sbin/init, which then is a symlink:

/sbin/init -> ../lib/systemd/systemd*

The following would work:
[[ $(readlink -f $(cat /proc/1/cmdline)) == *systemd* ]]

A better method (from http://unix.stackexchange.com/a/164092/1920) might be [[systemctl=~ -\.mount ]] or something similar though.

Systemd detection broken in xubuntu

I'm setting up autorandr on (X)ubuntu 16.04.

I noticed the proposed fix in systemd detection on arch (#38) does not work universally.

On (x)ubuntu 16.04 /proc/1/cmdline outputs initsplash which does not exist in /sbin/.
However, /sbin/init is linked to /lib/systemd/systemd.

This causes the make install command to skip installing the systemd service.

How about checking /proc/1/comm instead (kernel 2.6+...how many use this older kernels?) or using multiple methods?

/proc/1/comm Works on RHEL, (X)ubuntu for instance and probably all systemd enabled distributions.

So maybe have something like this in the Makefile:
HAVE_SYSTEMD=(shell grep -q systemd /proc/1/comm && echo "y")

Thanks for an excellent tool btw =)

postswitch not executed

Hello,

I am using postswitch script which launches polybar after i plug/unplug a screen:

#!/usr/bin/env bash
LOG_FILE="$HOME/.autorandr/log"
# Close STDOUT file descriptor
exec 1<&-
# Close STDERR FD
exec 2<&-

# Open STDOUT as $LOG_FILE file for read and write.
exec 1<>$LOG_FILE

# Redirect STDERR to STDOUT
exec 2>&1

killall -q polybar
while pgrep -x polybar >/dev/null; do sleep 1; done
echo "unset"
unset MONITOR
for mon in $(polybar -m | awk -F: '{print $1}'); do
    /usr/bin/polybar $mon &
done

After doing so, i tried plugging / unplugging the new monitor while tailing the logfile and it seems like nothing happens.

I am running ArchLinux Linux arch 4.10.11-1-ARCH #1 SMP PREEMPT Tue Apr 18 08:39:42 CEST 2017 x86_64 GNU/Linux

Thanks

contrib/pm-utils/40autorandr should be installed always/mostly

The Makefile will not install contrib/pm-utils/40autorandr in case /usr/sbin/pm-suspend does not exist, but it's used by the systemd and udev scripts, too.

Apart from that the script should maybe be moved to a more generic place, e.g. /var/lib/autorandr and then be used from there?!

ValueError: illegal environment variable name

I can't run the autorandr service after using make deb from current master:

--- display/autorandr ‹master* ⁇› » systemctl status autorandr.service
● autorandr.service - autorandr execution hook
   Loaded: loaded (/lib/systemd/system/autorandr.service; enabled; vendor preset: enabled)
   Active: inactive (dead)

Nov 07 21:54:26 rocinante autorandr[25228]:     fork_child_autorandr(pwent, process_environ)
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/bin/autorandr", line 862, in fork_child_autorandr
Nov 07 21:54:26 rocinante autorandr[25228]:     os.environ.update(process_environ)
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/lib/python2.7/os.py", line 488, in update
Nov 07 21:54:26 rocinante autorandr[25228]:     self[k] = dict[k]
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/lib/python2.7/os.py", line 473, in __setitem__
Nov 07 21:54:26 rocinante autorandr[25228]:     putenv(key, item)
Nov 07 21:54:26 rocinante autorandr[25228]: ValueError: illegal environment variable name
Nov 07 21:54:26 rocinante autorandr[25228]: Running autorandr as varac for display :0
Nov 07 21:54:26 rocinante systemd[1]: Started autorandr execution hook.
--- display/autorandr ‹master* ⁇› »                                             
Nov 07 21:54:26 rocinante systemd[1]: Starting autorandr execution hook...
Nov 07 21:54:26 rocinante autorandr[25228]: Unhandled exception (illegal environment variable name). Please report this as a bug at https://github.com/phillipberndt/autorandr/issues.
Nov 07 21:54:26 rocinante autorandr[25228]: Running autorandr as varac for display :0
Nov 07 21:54:26 rocinante autorandr[25228]: Traceback (most recent call last):
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/bin/autorandr", line 1151, in <module>
Nov 07 21:54:26 rocinante autorandr[25228]:     exception_handled_main() 
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/bin/autorandr", line 1138, in exception_handled_main
Nov 07 21:54:26 rocinante autorandr[25228]:     main(sys.argv)
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/bin/autorandr", line 947, in main
Nov 07 21:54:26 rocinante autorandr[25228]:     dispatch_call_to_sessions([ x for x in argv if x != "--batch" ])
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/bin/autorandr", line 916, in dispatch_call_to_sessions
Nov 07 21:54:26 rocinante autorandr[25228]:     fork_child_autorandr(pwent, process_environ)
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/bin/autorandr", line 862, in fork_child_autorandr
Nov 07 21:54:26 rocinante autorandr[25228]:     os.environ.update(process_environ)
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/lib/python2.7/os.py", line 488, in update
Nov 07 21:54:26 rocinante autorandr[25228]:     self[k] = dict[k]
Nov 07 21:54:26 rocinante autorandr[25228]:   File "/usr/lib/python2.7/os.py", line 473, in __setitem__
Nov 07 21:54:26 rocinante autorandr[25228]:     putenv(key, item)
Nov 07 21:54:26 rocinante autorandr[25228]: ValueError: illegal environment variable name
Nov 07 21:54:26 rocinante autorandr[25228]: Running autorandr as varac for display :0

Using the autorandr binary like this works:

--- display/autorandr ‹master* ⁇› » autorandr                               
undocked
docked (detected) (current)

Python: identical profiles, choose last used (?)

I use two different setups when I have my external monitor plugged in. Would be nice if --change chose the one last used. I was thinking of just touch'ing the setup files (for compatibility reasons). Are you OK with this?

Differences in gamma value

I've noticed that a setup is not being detected as active already, because
of a difference in the --gamma value (the last number):

{'DP1': <DP1 --output DP1 --off>,
 'DP2': <DP2 --output DP2 --off>,
 'DP3': <DP3 --output DP3 --off>,
 'HDMI1': <HDMI1 00fff..000ee --output HDMI1 --gamma 1.0:1.1:1.2 --mode 1920x1080 --panning 0x0 --pos 1366x0 --rate 60.0 --reflect normal --rotate normal --transform 1,0,0,0,1,0,0,0,1>,
 'HDMI2': <HDMI2 --output HDMI2 --off>,
 'HDMI3': <HDMI3 --output HDMI3 --off>,
 'LVDS1': <LVDS1 00fff..30059 --output LVDS1 --gamma 1.0:1.1:1.2 --mode 1366x768 --panning 0x0 --pos 0x312 --primary --rate 60.0 --reflect normal --rotate normal --transform 1,0,0,0,1,0,0,0,1>,
 'VGA1': <VGA1 --output VGA1 --off>,
 'VIRTUAL1': <VIRTUAL1 --output VIRTUAL1 --off>}

{'DP1': <DP1 --output DP1 --off>,
 'DP2': <DP2 --output DP2 --off>,
 'DP3': <DP3 --output DP3 --off>,
 'HDMI1': <HDMI1 00fff..000ee --output HDMI1 --gamma 1.0:1.2:1.3 --mode 1920x1080 --panning 0x0 --pos 1366x0 --rate 60.0 --reflect normal --rotate normal --transform 1,0,0,0,1,0,0,0,1>,
 'HDMI2': <HDMI2 --output HDMI2 --off>,
 'HDMI3': <HDMI3 --output HDMI3 --off>,
 'LVDS1': <LVDS1 00fff..30059 --output LVDS1 --gamma 1.0:1.2:1.3 --mode 1366x768 --panning 0x0 --pos 0x312 --primary --rate 60.0 --reflect normal --rotate normal --transform 1,0,0,0,1,0,0,0,1>,
 'VGA1': <VGA1 --output VGA1 --off>,
 'VIRTUAL1': <VIRTUAL1 --output VIRTUAL1 --off>}

I am not sure what might have changed this?

Maybe this could be considered irrelevant? (if we figure out / it turns out that it's nothing that was set explicitly)

For now, I've resaved it.

Profile specific scripts should be executed in addition to global ones

# If there are multiple candidates, the XDG spec tells to only use the first one.

At least my intuitive understanding would have been, that scripts hin the home directory overwrite scritps in /etc/xdg (as the comment says and is the case), but multiple scripts in the home directory complement each other.

For example I would like to have one global script that notifies my window manager and then one script for each profile that does some profile specific setup (like adjusting the volume).

Also I think there is a documentation issue here: I couldn't find the possibility of per-profile scripts documented anywhere but in the source code.

autorandr might be run too early after resuming

Re #29:
I've noticed that autorandr might not detect the config as being different just after resuming (when using systemd), probably because it's being run too early - but I've not investigated further yet.

This could maybe get fixed by just using a "sleep 5" in there.

This might also be the case for the pm-utils hook, but I have not tried that one yet.

Maybe my systemd service (from #29) just needs to be fixed though.

Failed to apply profile 'profile-name' (line 1343)

Hi.

I get the following error message for autorandr --change --force, autorandr --load jaque --force.

 $ autorandr --load jaque --force
Failed to apply profile 'jaque' (line 1343):
  [Errno 8] Exec format error
This appears to be a bug. Please help improving autorandr by reporting it upstream:
https://github.com/phillipberndt/autorandr/issues
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

Here's the output for xrandr --verbose.

Screen 0: minimum 8 x 8, current 1920 x 2280, maximum 32767 x 32767
eDP1 connected 1920x1080+0+1200 (0x4a) normal (normal left inverted right x axis y axis) 309mm x 173mm
	Identifier: 0x43
	Timestamp:  20428232
	Subpixel:   unknown
	Gamma:      1.0:1.0:1.0
	Brightness: 1.0
	Clones:    
	CRTC:       0
	CRTCs:      0 1 2
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	EDID: 
		00ffffffffffff0006af3d1200000000
		00180104951f117802e2959e59529926
		1c505400000001010101010101010101
		010101010101b03680b470381e403064
		310035ad100000180000000f00000000
		00000000000000000020000000fe0041
		554f0a202020202020202020000000fe
		004231343048544e30312e32200a0082
	BACKLIGHT: 639 
		range: (0, 852)
	Backlight: 639 
		range: (0, 852)
	scaling mode: Full aspect 
		supported: None, Full, Center, Full aspect
	Broadcast RGB: Automatic 
		supported: Automatic, Full, Limited 16:235
	audio: auto 
		supported: force-dvi, off, auto, on
  1920x1080 (0x4a) 140.000MHz -HSync -VSync *current +preferred
        h: width  1920 start 1968 end 2068 total 2100 skew    0 clock  66.67KHz
        v: height 1080 start 1083 end 1084 total 1110           clock  60.06Hz
  1920x1080 (0x108) 138.500MHz +HSync -VSync
        h: width  1920 start 1968 end 2000 total 2080 skew    0 clock  66.59KHz
        v: height 1080 start 1083 end 1088 total 1111           clock  59.93Hz
  1680x1050 (0x109) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1680x1050 (0x10a) 119.000MHz +HSync -VSync
        h: width  1680 start 1728 end 1760 total 1840 skew    0 clock  64.67KHz
        v: height 1050 start 1053 end 1059 total 1080           clock  59.88Hz
  1600x1024 (0x10b) 103.125MHz +HSync +VSync
        h: width  1600 start 1600 end 1656 total 1664 skew    0 clock  61.97KHz
        v: height 1024 start 1024 end 1029 total 1030           clock  60.17Hz
  1400x1050 (0x10c) 122.000MHz +HSync +VSync
        h: width  1400 start 1488 end 1640 total 1880 skew    0 clock  64.89KHz
        v: height 1050 start 1052 end 1064 total 1082           clock  59.98Hz
  1600x900 (0x10d) 118.997MHz -HSync +VSync
        h: width  1600 start 1696 end 1864 total 2128 skew    0 clock  55.92KHz
        v: height  900 start  901 end  904 total  932           clock  60.00Hz
  1280x1024 (0x10e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1440x900 (0x10f) 106.500MHz -HSync +VSync
        h: width  1440 start 1520 end 1672 total 1904 skew    0 clock  55.93KHz
        v: height  900 start  903 end  909 total  934           clock  59.89Hz
  1280x960 (0x110) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1368x768 (0x111) 85.860MHz -HSync +VSync
        h: width  1368 start 1440 end 1584 total 1800 skew    0 clock  47.70KHz
        v: height  768 start  769 end  772 total  795           clock  60.00Hz
  1360x768 (0x112) 84.750MHz -HSync +VSync
        h: width  1360 start 1432 end 1568 total 1776 skew    0 clock  47.72KHz
        v: height  768 start  771 end  781 total  798           clock  59.80Hz
  1360x768 (0x113) 72.000MHz +HSync -VSync
        h: width  1360 start 1408 end 1440 total 1520 skew    0 clock  47.37KHz
        v: height  768 start  771 end  781 total  790           clock  59.96Hz
  1152x864 (0x114) 81.620MHz -HSync +VSync
        h: width  1152 start 1216 end 1336 total 1520 skew    0 clock  53.70KHz
        v: height  864 start  865 end  868 total  895           clock  60.00Hz
  1280x720 (0x115) 74.480MHz -HSync +VSync
        h: width  1280 start 1336 end 1472 total 1664 skew    0 clock  44.76KHz
        v: height  720 start  721 end  724 total  746           clock  60.00Hz
  1024x768 (0x116) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  1024x576 (0x117) 46.995MHz -HSync +VSync
        h: width  1024 start 1064 end 1168 total 1312 skew    0 clock  35.82KHz
        v: height  576 start  577 end  580 total  597           clock  60.00Hz
  960x540 (0x118) 40.784MHz -HSync +VSync
        h: width   960 start  992 end 1088 total 1216 skew    0 clock  33.54KHz
        v: height  540 start  541 end  544 total  559           clock  60.00Hz
  800x600 (0x119) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x11a) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  864x486 (0x11b) 32.901MHz -HSync +VSync
        h: width   864 start  888 end  976 total 1088 skew    0 clock  30.24KHz
        v: height  486 start  487 end  490 total  504           clock  60.00Hz
  640x480 (0x11c) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x405 (0x11d) 22.176MHz -HSync +VSync
        h: width   720 start  728 end  800 total  880 skew    0 clock  25.20KHz
        v: height  405 start  406 end  409 total  420           clock  60.00Hz
  640x360 (0x11e) 17.187MHz -HSync +VSync
        h: width   640 start  640 end  704 total  768 skew    0 clock  22.38KHz
        v: height  360 start  361 end  364 total  373           clock  60.00Hz
DP1 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x44
	Timestamp:  20428232
	Subpixel:   unknown
	Clones:     HDMI1
	CRTCs:      0 1 2
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	Broadcast RGB: Automatic 
		supported: Automatic, Full, Limited 16:235
	audio: auto 
		supported: force-dvi, off, auto, on
DP1-1 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x123
	Timestamp:  20428232
	Subpixel:   unknown
	Clones:     DP1-8
	CRTCs:      0 1 2
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	Broadcast RGB: Automatic 
		supported: Automatic, Full, Limited 16:235
	audio: auto 
		supported: force-dvi, off, auto, on
DP1-8 connected 1920x1200+0+0 (0x124) normal (normal left inverted right x axis y axis) 518mm x 324mm
	Identifier: 0x122
	Timestamp:  20428232
	Subpixel:   unknown
	Gamma:      1.0:1.0:1.0
	Brightness: 1.0
	Clones:     DP1-1
	CRTC:       1
	CRTCs:      0 1 2
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	EDID: 
		00ffffffffffff0010ac46f04c454543
		2d180104b53420783a1df5ae4f35b325
		0d5054a54b008180a940d100714f0101
		010101010101283c80a070b023403020
		360006442100001a000000ff00585458
		584b3442344345454c0a000000fc0044
		454c4c2055323431330a2020000000fd
		00384c1e5111000a20202020202001bf
		02031df15090050403020716011f1213
		142015110623091f0783010000023a80
		1871382d40582c450006442100001e01
		1d8018711c1620582c25000644210000
		9e011d007251d01e206e285500064421
		00001e8c0ad08a20e02d10103e960006
		44210000180000000000000000000000
		00000000000000000000000000000009
	Broadcast RGB: Automatic 
		supported: Automatic, Full, Limited 16:235
	audio: auto 
		supported: force-dvi, off, auto, on
  1920x1200 (0x124) 154.000MHz +HSync -VSync *current +preferred
        h: width  1920 start 1968 end 2000 total 2080 skew    0 clock  74.04KHz
        v: height 1200 start 1203 end 1209 total 1235           clock  59.95Hz
  1920x1080 (0x125) 148.500MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x126) 148.500MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  56.25KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  50.00Hz
  1920x1080 (0x127) 148.352MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1920x1080 (0x128) 74.250MHz +HSync +VSync
        h: width  1920 start 2558 end 2602 total 2750 skew    0 clock  27.00KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  24.00Hz
  1920x1080 (0x129) 74.176MHz +HSync +VSync
        h: width  1920 start 2558 end 2602 total 2750 skew    0 clock  26.97KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  23.98Hz
  1600x1200 (0x12a) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1280x1024 (0x12b) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x10e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1152x864 (0x12c) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  1280x720 (0x12d) 74.250MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x12e) 74.250MHz +HSync +VSync
        h: width  1280 start 1720 end 1760 total 1980 skew    0 clock  37.50KHz
        v: height  720 start  725 end  730 total  750           clock  50.00Hz
  1280x720 (0x12f) 74.176MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1024x768 (0x130) 78.800MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.06KHz
        v: height  768 start  769 end  772 total  800           clock  75.08Hz
  1024x768 (0x116) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x131) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x119) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  720x576 (0x132) 27.000MHz -HSync -VSync
        h: width   720 start  732 end  796 total  864 skew    0 clock  31.25KHz
        v: height  576 start  581 end  586 total  625           clock  50.00Hz
  720x480 (0x133) 27.027MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.50KHz
        v: height  480 start  489 end  495 total  525           clock  60.00Hz
  720x480 (0x134) 27.000MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  640x480 (0x135) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x136) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  640x480 (0x11c) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x400 (0x137) 28.320MHz -HSync +VSync
        h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
        v: height  400 start  412 end  414 total  449           clock  70.08Hz
DP2 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x45
	Timestamp:  20428232
	Subpixel:   unknown
	Clones:     HDMI2
	CRTCs:      0 1 2
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	Broadcast RGB: Automatic 
		supported: Automatic, Full, Limited 16:235
	audio: auto 
		supported: force-dvi, off, auto, on
HDMI1 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x46
	Timestamp:  20428232
	Subpixel:   unknown
	Clones:     DP1
	CRTCs:      0 1 2
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	aspect ratio: Automatic 
		supported: Automatic, 4:3, 16:9
	Broadcast RGB: Automatic 
		supported: Automatic, Full, Limited 16:235
	audio: auto 
		supported: force-dvi, off, auto, on
HDMI2 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x47
	Timestamp:  20428232
	Subpixel:   unknown
	Clones:     DP2
	CRTCs:      0 1 2
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	aspect ratio: Automatic 
		supported: Automatic, 4:3, 16:9
	Broadcast RGB: Automatic 
		supported: Automatic, Full, Limited 16:235
	audio: auto 
		supported: force-dvi, off, auto, on
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
	Identifier: 0x48
	Timestamp:  20428232
	Subpixel:   no subpixels
	Clones:    
	CRTCs:      3
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 

I think everything was fine until I enabled DisplayPort 1.2 on one of the monitors I used. Which is the one the profile jaque is for. But the error appears whatever the profile is.

Please tell if if I can provide any more information.

autorandr can't handle custom modes unless they are created before loading the profile

Hello,

I'm running a QHD monitor on HDMI at full resolution, which HDMI of course doesn't support. To resolve this I'm running it at 45 Hz. Which the screen of course doesn't announce that it works. But it works well by adding a custom mode to xrandr.

The issue I'm having is to load a profile using a custom mode without adding the mode manually first.

This is me loading the profile:

etu@phouchg:~$ autorandr -l desk
xrandr: cannot find mode 2560x1440_45.00
Failed to apply profile 'desk' (line 610):
  Command failed: xrandr --output HDMI2 --gamma 1.0:1.0:1.0 --mode 2560x1440_45.00 --panning 0x0 --pos 3840x0 --rate 45.00 --reflect normal --rotate normal --transform 1.399994,0.000000,0.000000,0.000000,1.399994,0.000000,0.000000,0.000000,1.000000 (line 610)
This appears to be a bug. Please help improving autorandr by reporting it upstream.
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

This is xrandr --verbose output before adding the custom mode:

etu@phouchg:~$ xrandr --verbose
Screen 0: minimum 8 x 8, current 3840 x 2160, maximum 32767 x 32767
eDP1 connected (normal left inverted right x axis y axis)
    Identifier: 0x43
    Timestamp:  257105905
    Subpixel:   unknown
    Clones:    
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
        00ffffffffffff0030e49a0400000000
        00180104a51f1178021715a556519c27
        0c505400000001010101010101010101
        010101010101e45c00a0a0a011503020
        230036ae1000001a0000000000000000
        00000000000000000000000000fe004c
        4720446973706c61790a2020000000fe
        004c503134305148312d5350463100da
    BACKLIGHT: 277 
        range: (0, 852)
    Backlight: 277 
        range: (0, 852)
    scaling mode: Full aspect 
        supported: None, Full, Center, Full aspect
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
  2560x1440 (0x4a) 237.800MHz +HSync -VSync +preferred
        h: width  2560 start 2608 end 2640 total 2720 skew    0 clock  87.43KHz
        v: height 1440 start 1442 end 1445 total 1457           clock  60.00Hz
  1920x1440 (0x106) 234.000MHz -HSync +VSync
        h: width  1920 start 2048 end 2256 total 2600 skew    0 clock  90.00KHz
        v: height 1440 start 1441 end 1444 total 1500           clock  60.00Hz
  1856x1392 (0x107) 218.300MHz -HSync +VSync
        h: width  1856 start 1952 end 2176 total 2528 skew    0 clock  86.35KHz
        v: height 1392 start 1393 end 1396 total 1439           clock  60.01Hz
  1792x1344 (0x108) 204.800MHz -HSync +VSync
        h: width  1792 start 1920 end 2120 total 2448 skew    0 clock  83.66KHz
        v: height 1344 start 1345 end 1348 total 1394           clock  60.01Hz
  2048x1152 (0x109) 197.967MHz -HSync +VSync
        h: width  2048 start 2184 end 2408 total 2768 skew    0 clock  71.52KHz
        v: height 1152 start 1153 end 1156 total 1192           clock  60.00Hz
  1920x1080 (0x10a) 172.798MHz -HSync +VSync
        h: width  1920 start 2040 end 2248 total 2576 skew    0 clock  67.08KHz
        v: height 1080 start 1081 end 1084 total 1118           clock  60.00Hz
  1600x1200 (0x10b) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1400x1050 (0x10c) 122.000MHz +HSync +VSync
        h: width  1400 start 1488 end 1640 total 1880 skew    0 clock  64.89KHz
        v: height 1050 start 1052 end 1064 total 1082           clock  59.98Hz
  1600x900 (0x10d) 118.997MHz -HSync +VSync
        h: width  1600 start 1696 end 1864 total 2128 skew    0 clock  55.92KHz
        v: height  900 start  901 end  904 total  932           clock  60.00Hz
  1280x1024 (0x10e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x960 (0x10f) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1368x768 (0x110) 85.860MHz -HSync +VSync
        h: width  1368 start 1440 end 1584 total 1800 skew    0 clock  47.70KHz
        v: height  768 start  769 end  772 total  795           clock  60.00Hz
  1280x720 (0x111) 74.480MHz -HSync +VSync
        h: width  1280 start 1336 end 1472 total 1664 skew    0 clock  44.76KHz
        v: height  720 start  721 end  724 total  746           clock  60.00Hz
  1024x768 (0x112) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  1024x576 (0x113) 46.995MHz -HSync +VSync
        h: width  1024 start 1064 end 1168 total 1312 skew    0 clock  35.82KHz
        v: height  576 start  577 end  580 total  597           clock  60.00Hz
  960x540 (0x114) 40.784MHz -HSync +VSync
        h: width   960 start  992 end 1088 total 1216 skew    0 clock  33.54KHz
        v: height  540 start  541 end  544 total  559           clock  60.00Hz
  800x600 (0x115) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x116) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  864x486 (0x117) 32.901MHz -HSync +VSync
        h: width   864 start  888 end  976 total 1088 skew    0 clock  30.24KHz
        v: height  486 start  487 end  490 total  504           clock  60.00Hz
  640x480 (0x118) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x405 (0x119) 22.176MHz -HSync +VSync
        h: width   720 start  728 end  800 total  880 skew    0 clock  25.20KHz
        v: height  405 start  406 end  409 total  420           clock  60.00Hz
  640x360 (0x11a) 17.187MHz -HSync +VSync
        h: width   640 start  640 end  704 total  768 skew    0 clock  22.38KHz
        v: height  360 start  361 end  364 total  373           clock  60.00Hz
DP1 connected 3840x2160+0+0 (0x12b) normal (normal left inverted right x axis y axis) 597mm x 336mm
    Identifier: 0x44
    Timestamp:  257105905
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:     HDMI1
    CRTC:       0
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
        00ffffffffffff0010acbd4053323435
        31190104a53c22783aee95a3544c9926
        0f5054a54b00d100d1c0b300a9408180
        8100714f01014dd000a0f0703e803020
        350055502100001a000000ff00563757
        5039354334353432530a000000fc0044
        454c4c205032373135510a20000000fd
        001d4b1f8c36010a20202020202001b8
        02031df150101f200514041312110302
        161507060123091f0783010000a36600
        a0f0701f803020350055502100001a56
        5e00a0a0a02950302035005550210000
        1a023a801871382d40582c4500555021
        00001e011d007251d01e206e28550055
        502100001e0000000000000000000000
        00000000000000000000000000000013
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
  3840x2160 (0x12b) 533.250MHz +HSync -VSync *current +preferred
        h: width  3840 start 3888 end 3920 total 4000 skew    0 clock 133.31KHz
        v: height 2160 start 2163 end 2168 total 2222           clock  60.00Hz
  3840x2160 (0x12c) 262.750MHz +HSync -VSync
        h: width  3840 start 3888 end 3920 total 4000 skew    0 clock  65.69KHz
        v: height 2160 start 2163 end 2168 total 2191           clock  29.98Hz
  2560x1440 (0x12d) 241.500MHz +HSync -VSync
        h: width  2560 start 2608 end 2640 total 2720 skew    0 clock  88.79KHz
        v: height 1440 start 1443 end 1448 total 1481           clock  59.95Hz
  1920x1200 (0x12e) 193.250MHz -HSync +VSync
        h: width  1920 start 2056 end 2256 total 2592 skew    0 clock  74.56KHz
        v: height 1200 start 1203 end 1209 total 1245           clock  59.88Hz
  1920x1080 (0x12f) 148.500MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x130) 148.500MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  56.25KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  50.00Hz
  1920x1080 (0x131) 148.352MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1920x1080i (0x132) 74.250MHz +HSync +VSync Interlace
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.75KHz
        v: height 1080 start 1084 end 1094 total 1125           clock  60.00Hz
  1920x1080i (0x133) 74.250MHz +HSync +VSync Interlace
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  28.12KHz
        v: height 1080 start 1084 end 1094 total 1125           clock  50.00Hz
  1920x1080 (0x134) 74.250MHz +HSync +VSync
        h: width  1920 start 2558 end 2602 total 2750 skew    0 clock  27.00KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  24.00Hz
  1920x1080i (0x135) 74.176MHz +HSync +VSync Interlace
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.72KHz
        v: height 1080 start 1084 end 1094 total 1125           clock  59.94Hz
  1920x1080 (0x136) 74.176MHz +HSync +VSync
        h: width  1920 start 2558 end 2602 total 2750 skew    0 clock  26.97KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  23.98Hz
  1600x1200 (0x10b) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1680x1050 (0x137) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1280x1024 (0x138) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x10e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x800 (0x139) 83.500MHz -HSync +VSync
        h: width  1280 start 1352 end 1480 total 1680 skew    0 clock  49.70KHz
        v: height  800 start  803 end  809 total  831           clock  59.81Hz
  1152x864 (0x13a) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  1280x720 (0x13b) 74.250MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x13c) 74.250MHz +HSync +VSync
        h: width  1280 start 1720 end 1760 total 1980 skew    0 clock  37.50KHz
        v: height  720 start  725 end  730 total  750           clock  50.00Hz
  1280x720 (0x13d) 74.176MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1024x768 (0x13e) 78.800MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.06KHz
        v: height  768 start  769 end  772 total  800           clock  75.08Hz
  1024x768 (0x112) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x13f) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x115) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  720x576 (0x140) 27.000MHz -HSync -VSync
        h: width   720 start  732 end  796 total  864 skew    0 clock  31.25KHz
        v: height  576 start  581 end  586 total  625           clock  50.00Hz
  720x480 (0x141) 27.027MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.50KHz
        v: height  480 start  489 end  495 total  525           clock  60.00Hz
  720x480 (0x142) 27.000MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  640x480 (0x143) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x144) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  640x480 (0x118) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x400 (0x145) 28.320MHz -HSync +VSync
        h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
        v: height  400 start  412 end  414 total  449           clock  70.08Hz
DP2 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x45
    Timestamp:  257105905
    Subpixel:   unknown
    Clones:     HDMI2
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
HDMI1 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x46
    Timestamp:  257105905
    Subpixel:   unknown
    Clones:     DP1
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    aspect ratio: Automatic 
        supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
HDMI2 connected (normal left inverted right x axis y axis)
    Identifier: 0x47
    Timestamp:  257105905
    Subpixel:   unknown
    Clones:     DP2
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
        00ffffffffffff004c2d89085632555a
        21160103803c22782a73a1a4544d9926
        0f5054bfef80a9408180814081009500
        b300714f950f023a801871382d40582c
        450055502100001e011d007251d01e20
        6e28550055502100001e000000fd0038
        4b1e5111000a202020202020000000fc
        00534d53323741383530540a20200145
        02031af14690041f1303122309070783
        01000066030c00100080011d00bc52d0
        1e20b828554055502100001e8c0ad090
        204031200c4055005550210000188c0a
        d08a20e02d10103e9600555021000018
        023a80d072382d40102c458055502100
        001e0000000000000000000000000000
        000000000000000000000000000000dc
    aspect ratio: Automatic 
        supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
  1920x1080 (0x12f) 148.500MHz +HSync +VSync +preferred
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x130) 148.500MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  56.25KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  50.00Hz
  1920x1080 (0x131) 148.352MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1600x1200 (0x10b) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1680x1050 (0x146) 119.000MHz +HSync -VSync
        h: width  1680 start 1728 end 1760 total 1840 skew    0 clock  64.67KHz
        v: height 1050 start 1053 end 1059 total 1080           clock  59.88Hz
  1280x1024 (0x138) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x10e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1440x900 (0x147) 136.750MHz -HSync +VSync
        h: width  1440 start 1536 end 1688 total 1936 skew    0 clock  70.64KHz
        v: height  900 start  903 end  909 total  942           clock  74.98Hz
  1440x900 (0x148) 88.750MHz +HSync -VSync
        h: width  1440 start 1488 end 1520 total 1600 skew    0 clock  55.47KHz
        v: height  900 start  903 end  909 total  926           clock  59.90Hz
  1280x960 (0x10f) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1280x800 (0x149) 71.000MHz +HSync -VSync
        h: width  1280 start 1328 end 1360 total 1440 skew    0 clock  49.31KHz
        v: height  800 start  803 end  809 total  823           clock  59.91Hz
  1152x864 (0x13a) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  1280x720 (0x13b) 74.250MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x13c) 74.250MHz +HSync +VSync
        h: width  1280 start 1720 end 1760 total 1980 skew    0 clock  37.50KHz
        v: height  720 start  725 end  730 total  750           clock  50.00Hz
  1280x720 (0x13d) 74.176MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1024x768 (0x13e) 78.800MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.06KHz
        v: height  768 start  769 end  772 total  800           clock  75.08Hz
  1024x768 (0x14a) 75.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1328 skew    0 clock  56.48KHz
        v: height  768 start  771 end  777 total  806           clock  70.07Hz
  1024x768 (0x112) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  832x624 (0x14b) 57.284MHz -HSync -VSync
        h: width   832 start  864 end  928 total 1152 skew    0 clock  49.73KHz
        v: height  624 start  625 end  628 total  667           clock  74.55Hz
  800x600 (0x14c) 50.000MHz +HSync +VSync
        h: width   800 start  856 end  976 total 1040 skew    0 clock  48.08KHz
        v: height  600 start  637 end  643 total  666           clock  72.19Hz
  800x600 (0x13f) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x115) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x116) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  720x576 (0x140) 27.000MHz -HSync -VSync
        h: width   720 start  732 end  796 total  864 skew    0 clock  31.25KHz
        v: height  576 start  581 end  586 total  625           clock  50.00Hz
  720x480 (0x141) 27.027MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.50KHz
        v: height  480 start  489 end  495 total  525           clock  60.00Hz
  720x480 (0x142) 27.000MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  640x480 (0x143) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x14d) 31.500MHz -HSync -VSync
        h: width   640 start  664 end  704 total  832 skew    0 clock  37.86KHz
        v: height  480 start  489 end  491 total  520           clock  72.81Hz
  640x480 (0x14e) 30.240MHz -HSync -VSync
        h: width   640 start  704 end  768 total  864 skew    0 clock  35.00KHz
        v: height  480 start  483 end  486 total  525           clock  66.67Hz
  640x480 (0x144) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  640x480 (0x118) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x400 (0x145) 28.320MHz -HSync +VSync
        h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
        v: height  400 start  412 end  414 total  449           clock  70.08Hz
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x48
    Timestamp:  257105905
    Subpixel:   no subpixels
    Clones:    
    CRTCs:      3
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter:

This is xrandr --verbose after adding the custom mode:

etu@phouchg:~$ xrandr --verbose
Screen 0: minimum 8 x 8, current 7424 x 2160, maximum 32767 x 32767
eDP1 connected (normal left inverted right x axis y axis)
    Identifier: 0x43
    Timestamp:  257175571
    Subpixel:   unknown
    Clones:    
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
        00ffffffffffff0030e49a0400000000
        00180104a51f1178021715a556519c27
        0c505400000001010101010101010101
        010101010101e45c00a0a0a011503020
        230036ae1000001a0000000000000000
        00000000000000000000000000fe004c
        4720446973706c61790a2020000000fe
        004c503134305148312d5350463100da
    BACKLIGHT: 277 
        range: (0, 852)
    Backlight: 277 
        range: (0, 852)
    scaling mode: Full aspect 
        supported: None, Full, Center, Full aspect
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
  2560x1440 (0x4a) 237.800MHz +HSync -VSync +preferred
        h: width  2560 start 2608 end 2640 total 2720 skew    0 clock  87.43KHz
        v: height 1440 start 1442 end 1445 total 1457           clock  60.00Hz
  1920x1440 (0x106) 234.000MHz -HSync +VSync
        h: width  1920 start 2048 end 2256 total 2600 skew    0 clock  90.00KHz
        v: height 1440 start 1441 end 1444 total 1500           clock  60.00Hz
  1856x1392 (0x107) 218.300MHz -HSync +VSync
        h: width  1856 start 1952 end 2176 total 2528 skew    0 clock  86.35KHz
        v: height 1392 start 1393 end 1396 total 1439           clock  60.01Hz
  1792x1344 (0x108) 204.800MHz -HSync +VSync
        h: width  1792 start 1920 end 2120 total 2448 skew    0 clock  83.66KHz
        v: height 1344 start 1345 end 1348 total 1394           clock  60.01Hz
  2048x1152 (0x109) 197.967MHz -HSync +VSync
        h: width  2048 start 2184 end 2408 total 2768 skew    0 clock  71.52KHz
        v: height 1152 start 1153 end 1156 total 1192           clock  60.00Hz
  1920x1080 (0x10a) 172.798MHz -HSync +VSync
        h: width  1920 start 2040 end 2248 total 2576 skew    0 clock  67.08KHz
        v: height 1080 start 1081 end 1084 total 1118           clock  60.00Hz
  1600x1200 (0x10b) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1400x1050 (0x10c) 122.000MHz +HSync +VSync
        h: width  1400 start 1488 end 1640 total 1880 skew    0 clock  64.89KHz
        v: height 1050 start 1052 end 1064 total 1082           clock  59.98Hz
  1600x900 (0x10d) 118.997MHz -HSync +VSync
        h: width  1600 start 1696 end 1864 total 2128 skew    0 clock  55.92KHz
        v: height  900 start  901 end  904 total  932           clock  60.00Hz
  1280x1024 (0x10e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x960 (0x10f) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1368x768 (0x110) 85.860MHz -HSync +VSync
        h: width  1368 start 1440 end 1584 total 1800 skew    0 clock  47.70KHz
        v: height  768 start  769 end  772 total  795           clock  60.00Hz
  1280x720 (0x111) 74.480MHz -HSync +VSync
        h: width  1280 start 1336 end 1472 total 1664 skew    0 clock  44.76KHz
        v: height  720 start  721 end  724 total  746           clock  60.00Hz
  1024x768 (0x112) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  1024x576 (0x113) 46.995MHz -HSync +VSync
        h: width  1024 start 1064 end 1168 total 1312 skew    0 clock  35.82KHz
        v: height  576 start  577 end  580 total  597           clock  60.00Hz
  960x540 (0x114) 40.784MHz -HSync +VSync
        h: width   960 start  992 end 1088 total 1216 skew    0 clock  33.54KHz
        v: height  540 start  541 end  544 total  559           clock  60.00Hz
  800x600 (0x115) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x116) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  864x486 (0x117) 32.901MHz -HSync +VSync
        h: width   864 start  888 end  976 total 1088 skew    0 clock  30.24KHz
        v: height  486 start  487 end  490 total  504           clock  60.00Hz
  640x480 (0x118) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x405 (0x119) 22.176MHz -HSync +VSync
        h: width   720 start  728 end  800 total  880 skew    0 clock  25.20KHz
        v: height  405 start  406 end  409 total  420           clock  60.00Hz
  640x360 (0x11a) 17.187MHz -HSync +VSync
        h: width   640 start  640 end  704 total  768 skew    0 clock  22.38KHz
        v: height  360 start  361 end  364 total  373           clock  60.00Hz
DP1 connected 3840x2160+0+0 (0x12b) normal (normal left inverted right x axis y axis) 597mm x 336mm
    Identifier: 0x44
    Timestamp:  257175571
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:     HDMI1
    CRTC:       0
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
        00ffffffffffff0010acbd4053323435
        31190104a53c22783aee95a3544c9926
        0f5054a54b00d100d1c0b300a9408180
        8100714f01014dd000a0f0703e803020
        350055502100001a000000ff00563757
        5039354334353432530a000000fc0044
        454c4c205032373135510a20000000fd
        001d4b1f8c36010a20202020202001b8
        02031df150101f200514041312110302
        161507060123091f0783010000a36600
        a0f0701f803020350055502100001a56
        5e00a0a0a02950302035005550210000
        1a023a801871382d40582c4500555021
        00001e011d007251d01e206e28550055
        502100001e0000000000000000000000
        00000000000000000000000000000013
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
  3840x2160 (0x12b) 533.250MHz +HSync -VSync *current +preferred
        h: width  3840 start 3888 end 3920 total 4000 skew    0 clock 133.31KHz
        v: height 2160 start 2163 end 2168 total 2222           clock  60.00Hz
  3840x2160 (0x12c) 262.750MHz +HSync -VSync
        h: width  3840 start 3888 end 3920 total 4000 skew    0 clock  65.69KHz
        v: height 2160 start 2163 end 2168 total 2191           clock  29.98Hz
  2560x1440 (0x12d) 241.500MHz +HSync -VSync
        h: width  2560 start 2608 end 2640 total 2720 skew    0 clock  88.79KHz
        v: height 1440 start 1443 end 1448 total 1481           clock  59.95Hz
  1920x1200 (0x12e) 193.250MHz -HSync +VSync
        h: width  1920 start 2056 end 2256 total 2592 skew    0 clock  74.56KHz
        v: height 1200 start 1203 end 1209 total 1245           clock  59.88Hz
  1920x1080 (0x12f) 148.500MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x130) 148.500MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  56.25KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  50.00Hz
  1920x1080 (0x131) 148.352MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1920x1080i (0x132) 74.250MHz +HSync +VSync Interlace
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.75KHz
        v: height 1080 start 1084 end 1094 total 1125           clock  60.00Hz
  1920x1080i (0x133) 74.250MHz +HSync +VSync Interlace
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  28.12KHz
        v: height 1080 start 1084 end 1094 total 1125           clock  50.00Hz
  1920x1080 (0x134) 74.250MHz +HSync +VSync
        h: width  1920 start 2558 end 2602 total 2750 skew    0 clock  27.00KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  24.00Hz
  1920x1080i (0x135) 74.176MHz +HSync +VSync Interlace
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  33.72KHz
        v: height 1080 start 1084 end 1094 total 1125           clock  59.94Hz
  1920x1080 (0x136) 74.176MHz +HSync +VSync
        h: width  1920 start 2558 end 2602 total 2750 skew    0 clock  26.97KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  23.98Hz
  1600x1200 (0x10b) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1680x1050 (0x137) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1280x1024 (0x138) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x10e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x800 (0x139) 83.500MHz -HSync +VSync
        h: width  1280 start 1352 end 1480 total 1680 skew    0 clock  49.70KHz
        v: height  800 start  803 end  809 total  831           clock  59.81Hz
  1152x864 (0x13a) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  1280x720 (0x13b) 74.250MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x13c) 74.250MHz +HSync +VSync
        h: width  1280 start 1720 end 1760 total 1980 skew    0 clock  37.50KHz
        v: height  720 start  725 end  730 total  750           clock  50.00Hz
  1280x720 (0x13d) 74.176MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1024x768 (0x13e) 78.800MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.06KHz
        v: height  768 start  769 end  772 total  800           clock  75.08Hz
  1024x768 (0x112) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x13f) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x115) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  720x576 (0x140) 27.000MHz -HSync -VSync
        h: width   720 start  732 end  796 total  864 skew    0 clock  31.25KHz
        v: height  576 start  581 end  586 total  625           clock  50.00Hz
  720x480 (0x141) 27.027MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.50KHz
        v: height  480 start  489 end  495 total  525           clock  60.00Hz
  720x480 (0x142) 27.000MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  640x480 (0x143) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x144) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  640x480 (0x118) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x400 (0x145) 28.320MHz -HSync +VSync
        h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
        v: height  400 start  412 end  414 total  449           clock  70.08Hz
DP2 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x45
    Timestamp:  257175571
    Subpixel:   unknown
    Clones:     HDMI2
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
HDMI1 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x46
    Timestamp:  257175571
    Subpixel:   unknown
    Clones:     DP1
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    aspect ratio: Automatic 
        supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
HDMI2 connected 3584x2016+3840+0 (0x229) normal (normal left inverted right x axis y axis) 597mm x 336mm
    Identifier: 0x47
    Timestamp:  257175571
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:     DP2
    CRTC:       1
    CRTCs:      0 1 2
    Transform:  1.399994 0.000000 0.000000
                0.000000 1.399994 0.000000
                0.000000 0.000000 1.000000
               filter: bilinear
    EDID: 
        00ffffffffffff004c2d89085632555a
        21160103803c22782a73a1a4544d9926
        0f5054bfef80a9408180814081009500
        b300714f950f023a801871382d40582c
        450055502100001e011d007251d01e20
        6e28550055502100001e000000fd0038
        4b1e5111000a202020202020000000fc
        00534d53323741383530540a20200145
        02031af14690041f1303122309070783
        01000066030c00100080011d00bc52d0
        1e20b828554055502100001e8c0ad090
        204031200c4055005550210000188c0a
        d08a20e02d10103e9600555021000018
        023a80d072382d40102c458055502100
        001e0000000000000000000000000000
        000000000000000000000000000000dc
    aspect ratio: Automatic 
        supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
  1920x1080 (0x12f) 148.500MHz +HSync +VSync +preferred
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x130) 148.500MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  56.25KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  50.00Hz
  1920x1080 (0x131) 148.352MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1600x1200 (0x10b) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  1680x1050 (0x146) 119.000MHz +HSync -VSync
        h: width  1680 start 1728 end 1760 total 1840 skew    0 clock  64.67KHz
        v: height 1050 start 1053 end 1059 total 1080           clock  59.88Hz
  1280x1024 (0x138) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x10e) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1440x900 (0x147) 136.750MHz -HSync +VSync
        h: width  1440 start 1536 end 1688 total 1936 skew    0 clock  70.64KHz
        v: height  900 start  903 end  909 total  942           clock  74.98Hz
  1440x900 (0x148) 88.750MHz +HSync -VSync
        h: width  1440 start 1488 end 1520 total 1600 skew    0 clock  55.47KHz
        v: height  900 start  903 end  909 total  926           clock  59.90Hz
  1280x960 (0x10f) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1280x800 (0x149) 71.000MHz +HSync -VSync
        h: width  1280 start 1328 end 1360 total 1440 skew    0 clock  49.31KHz
        v: height  800 start  803 end  809 total  823           clock  59.91Hz
  1152x864 (0x13a) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  1280x720 (0x13b) 74.250MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x13c) 74.250MHz +HSync +VSync
        h: width  1280 start 1720 end 1760 total 1980 skew    0 clock  37.50KHz
        v: height  720 start  725 end  730 total  750           clock  50.00Hz
  1280x720 (0x13d) 74.176MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1024x768 (0x13e) 78.800MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.06KHz
        v: height  768 start  769 end  772 total  800           clock  75.08Hz
  1024x768 (0x14a) 75.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1328 skew    0 clock  56.48KHz
        v: height  768 start  771 end  777 total  806           clock  70.07Hz
  1024x768 (0x112) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  832x624 (0x14b) 57.284MHz -HSync -VSync
        h: width   832 start  864 end  928 total 1152 skew    0 clock  49.73KHz
        v: height  624 start  625 end  628 total  667           clock  74.55Hz
  800x600 (0x14c) 50.000MHz +HSync +VSync
        h: width   800 start  856 end  976 total 1040 skew    0 clock  48.08KHz
        v: height  600 start  637 end  643 total  666           clock  72.19Hz
  800x600 (0x13f) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x115) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x116) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  720x576 (0x140) 27.000MHz -HSync -VSync
        h: width   720 start  732 end  796 total  864 skew    0 clock  31.25KHz
        v: height  576 start  581 end  586 total  625           clock  50.00Hz
  720x480 (0x141) 27.027MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.50KHz
        v: height  480 start  489 end  495 total  525           clock  60.00Hz
  720x480 (0x142) 27.000MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  640x480 (0x143) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x14d) 31.500MHz -HSync -VSync
        h: width   640 start  664 end  704 total  832 skew    0 clock  37.86KHz
        v: height  480 start  489 end  491 total  520           clock  72.81Hz
  640x480 (0x14e) 30.240MHz -HSync -VSync
        h: width   640 start  704 end  768 total  864 skew    0 clock  35.00KHz
        v: height  480 start  483 end  486 total  525           clock  66.67Hz
  640x480 (0x144) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  640x480 (0x118) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x400 (0x145) 28.320MHz -HSync +VSync
        h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
        v: height  400 start  412 end  414 total  449           clock  70.08Hz
  2560x1440_45.00 (0x229) 228.790MHz -HSync +VSync *current
        h: width  2560 start 2728 end 3000 total 3440 skew    0 clock  66.51KHz
        v: height 1440 start 1441 end 1444 total 1478           clock  45.00Hz
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x48
    Timestamp:  257175571
    Subpixel:   no subpixels
    Clones:    
    CRTCs:      3
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter:

I add my mode by doing something like this:

xrandr --newmode $(gtf 2560 1440 45 | grep Modeline | sed 's/  Modeline //')
xrandr --addmode HDMI2 2560x1440_45.00

Originaly posted this bugreport here: wertarbyte/autorandr#40 but got pointed this way instead.

Unhandled Exception

I'm running Arch Linux with the latest autorandr-git AUR package.

Here's the journal log

#STUFF# systemd[1]: Starting autorandr execution hook...
#STUFF# autorandr[4734]: Unhandled exception (str expected, not int). Please report this as a bug at https://github.com/phillipberndt/autorandr/issues.
#STUFF# autorandr[4734]: Running autorandr as somini for display :0
#STUFF# autorandr[4734]: Traceback (most recent call last):
#STUFF# autorandr[4734]:   File "/usr/bin/autorandr", line 1090, in <module>
#STUFF# autorandr[4734]:     exception_handled_main()
#STUFF# autorandr[4734]:   File "/usr/bin/autorandr", line 1077, in exception_handled_main
#STUFF# autorandr[4734]:     main(sys.argv)
#STUFF# autorandr[4734]:   File "/usr/bin/autorandr", line 890, in main
#STUFF# autorandr[4734]:     dispatch_call_to_sessions([ x for x in argv if x != "--batch" ])
#STUFF# autorandr[4734]:   File "/usr/bin/autorandr", line 868, in dispatch_call_to_sessions
#STUFF# autorandr[4734]:     os.environ.update(process_environ)
#STUFF# autorandr[4734]:   File "/usr/lib/python3.6/_collections_abc.py", line 841, in update
#STUFF# autorandr[4734]:     self[key] = other[key]
#STUFF# autorandr[4734]:   File "/usr/lib/python3.6/os.py", line 674, in __setitem__
#STUFF# autorandr[4734]:     value = self.encodevalue(value)
#STUFF# autorandr[4734]:   File "/usr/lib/python3.6/os.py", line 742, in encode
#STUFF# autorandr[4734]:     raise TypeError("str expected, not %s" % type(value).__name__)
#STUFF# autorandr[4734]: TypeError: str expected, not int
#STUFF# autorandr[4734]: Running autorandr as somini for display :0
#STUFF# systemd[1]: Started autorandr execution hook.

/etc/pm/sleep.d/40autorandr fails with long user names

This is because w, which is used in favour of who, only reports the first eight characters of the user names.

As I am not sure whether this is a general issue with w or related to my version, here is the w --version output:

w from procps-ng 3.3.11

Wayland support

Most distributions are moving to wayland as default display server (or has already moved like Ubuntu since latest release 17.10). I wonder if there's any plan to support wayland ?
I quickly looked around and couldn't find any wayland tools similar to xrandr but maybe somebody else knows how to do this right in wayland ?

Feature Request: Toggle profiles when using the equal hardware fingerprints

Here is my setup: I have a monitor connected to my laptop. Most of the time I only use the connected monitor and let the laptop screen turned off.
Sometimes I need to have them both working, so i made profiles for each situation: One with the laptop screen being off and one with it being on, while allays having the monitor connected and used.
Unfortunately in this situation autorandr uses always only one of the profiles and does not toggle them if it detects multiple profiles with the same hardware fingerprints.

Segmentation fault during systemd user service

Hi,

autorandr works fine for me. I just noticed this segfault in the logs, thought it might be interesting for you:

Nov 12 20:55:29 rocinante systemd[1]: Starting autorandr execution hook...
Nov 12 20:55:30 rocinante autorandr[17623]: Segmentation fault (core dumped)
Nov 12 20:55:30 rocinante autorandr[17623]: Parsing XRandR output failed, 39 bytes left unmatched after regular expression, starting at byte 3658 with ..'800x600 (0'. (line 277)
Nov 12 20:55:30 rocinante autorandr[17623]: This appears to be a bug. Please help improving autorandr by reporting it upstream:
Nov 12 20:55:30 rocinante autorandr[17623]: https://github.com/phillipberndt/autorandr/issues
Nov 12 20:55:30 rocinante autorandr[17623]: Please attach the output of `xrandr --verbose` to your bug report if appropriate.
Nov 12 20:55:30 rocinante autorandr[17623]: Running autorandr as varac for display :0
Nov 12 20:55:30 rocinante systemd[1]: Started autorandr execution hook.

I'm fine with closing this issue as it seems to happen only once from what I could find in the logs.

Autorandr stopped working

I've updated numerous packages on Ubuntu 17.04 today and realized that autorandr doesn't work for me anymore when plugging/unplugging monitor. I've also tried systemd-change branch from #62, but it doesn't change anything.

What I'm getting is following:

$ env DISPLAY= sudo /usr/bin/autorandr --batch --change --default default                             
Running autorandr as lightdm for display :0
Invalid MIT-MAGIC-COOKIE-1 keyCan't open display :0
Failed to run xrandr (line 430)

I'm using Nvidia proprietary driver with nvidia-prime on laptop.

When running autorandr -c it works correctly.

Do you have any ideas what might be wrong?

autorandr cant load saved profile (configuration change did not go as expected)

I used arandr to apply a configuration (3 Monitors) and saved it with autorandr.
Then I switched to the laptop config -> works fine
When switching back to the 3 monitor settings I get an error and the configuration messed up (All monitors at same space).
At this stage also changing the settings with arandr does no longer work.
Help appreciated :)

Arandr config:
xrandr --output VGA-0 --off --output DP-6 --off --output DP-5 --off --output DP-4 --primary --mode 2560x1440 --pos 1920x0 --rotate normal --output DP-3 --mode 1920x1080 --pos 0x0 --rotate normal --output DP-2 --off --output DP-1 --mode 1920x1080 --pos 4480x0 --rotate normal --output DP-0 --off

Autorandr output:

./autorandr.py --debug -l work  
Loading profile 'work'
| Differences between the two profiles:
| [Output DP-4] Option --panning (= `6400x1440+0+0') is not present in the new configuration
| [Output DP-4] Option --pos (= `0x0') is `1920x0' in the new configuration
| [Output DP-3] Option --panning (= `5760x1080+0+0/6400x1440+0+0/0/0/0/0') is not present in the new configuration
| [Output DP-1] Option --panning (= `5760x1080+0+0/6400x1440+0+0/0/0/0/0') is not present in the new configuration
| [Output DP-1] Option --pos (= `0x0') is `4480x0' in the new configuration
\-
Going to run:
xrandr --output DP-3 --gamma 1.0:1.0:1.0 --mode 1920x1080 --panning 0x0 --pos 0x0 --rate 60.00 --reflect normal --rotate normal --output DP-4 --gamma 1.0:1.0:1.0 --mode 2560x1440 --panning 0x0 --pos 1920x0 --primary --rate 59.95 --reflect normal --rotate normal
xrandr --output DP-1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --panning 0x0 --pos 4480x0 --rate 60.00 --reflect normal --rotate normal
The configuration change did not go as expected:
| Differences between the two profiles:
| [Output DP-4] Option --panning (= `6400x1440+0+0') is not present in the new configuration
| [Output DP-4] Option --pos (= `0x0') is `1920x0' in the new configuration
| [Output DP-3] Option --panning (= `5760x1080+0+0/6400x1440+0+0/0/0/0/0') is not present in the new configuration
| [Output DP-1] Option --panning (= `5760x1080+0+0/6400x1440+0+0/0/0/0/0') is not present in the new configuration
| [Output DP-1] Option --pos (= `0x0') is `4480x0' in the new configuration
\-

xrandr: Configure crtc 0 failed

$ cat /var/log/autorandr.log 
xrandr: Configure crtc 0 failed
xrandr: Configure crtc 0 failed
default (detected)
extern (detected) (current)
laptop (detected)
Failed to apply profile 'default' (line 591):
  Command failed: xrandr --query --output VGA1 --off (line 591)
This appears to be a bug. Please help improving autorandr by reporting it upstream.
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

This happens when I disconnect my laptop from the docking station. Both external monitors (VGA1 and HDMI3) fail to turn off and the laptop screen (LVDS1) does not turn on. From there, i can either switch to a virtual console and restart X or put the laptop back in the docking station.

xrandr log while only laptop screen is attached (done from a virtual console): http://pastebin.com/NVAJc2Xj

pm-utils/40autorandr chokes when mutiple sessions exist

I've recently installed your version of autorandr, and I was quite excited at the prospect of udev rule integration. So far, however, that hasn't been working.

I've tracked it down to a failure in 40autorandr, in the find_user function. In short, the code on lines 19-36 relies on the fact that Active comes before Display in the loginctl show-session

On my machine, the output of loginctl show-session -p Active -p Display 1 (my id is 2) is:

Display=:0
Active=no

This is not dependent on the order of the -p flags in the above command.

The inner loop therefore gets to the echo $user logic before actually parsing the Active line. The final effect is that find_user reports something like "sddm myuser", an obviously invalid username.

For reference, systemd --version reports:

systemd 229
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN

I don't think its relevant here, but I've also attached the output of xrandr --verbose

Decide how to move forward with the python version

There are currently two versions of autorandr around due to the difficulties with #7.

The Python version has some advantages over the bash version. That is naturally the case, because in Python we can pass around objects without having to serialize everything all the time. Unique features are solutions to #8, #9, reduced configurations that only store non-default settings with autorandr.py setting the values upon loading of the profiles, support for reflection & gamma values, and of course improved speed because it does not need to call awk, sed, md5sum and so on. I therefore won't just throw that code away.

On the other hand, the bash version obviously needs maintenance as well.

I'll have to decide whether to separate both versions into their own repositories, which one to promote to the version I primarily concerned myself with, and whether to choose a different name for the rewrite.

udev support doesn't work on all systems

I have discussed this with phillipberndt in a couple threads now and thought I would add an issue here to see what comes of it. Although udev is certainly the best way of detecting system changes, it may not always work on all systems. This can be due to any number of reasons I am sure; faulty drivers, drivers lacking proper support, kernel bugs possibly? Who knows really, but the issue is real and can be found with a quick google search.

For me, I have an hdmi I would like to monitor change events and it only generates an event in udev maybe 1 out of every 20 times.

Three-screen layout only works when applied for a second time

So I've got a laptop (Dell E5450), which is hooked up to three monitors at work. When I insert the laptop into the dock, I have to run autorandr -c two times for my three screens to be used. The first time I run it, the laptop screen is disabled and only the desk screen is activated. When I run it a second time, the other two desk screens are activated.

This is the output of the first time I run autorandr:

xrandr: Configure crtc 0 failed
work (detected)
mobile (current)
Failed to apply profile 'work' (line 610):
  Command failed: xrandr --output DP1-2 --gamma 1.0:1.0:1.0 --mode 1920x1080 --panning 0x0 --pos 1920x0 --rate 60.00 --reflect normal --rotate normal --output DP1-3 --gamma 1.0:1.0:1.0 --mode 1920x1080 --panning 0x0 --pos 3840x0 --rate 60.00 --reflect normal --rotate normal (line 610)
This appears to be a bug. Please help improving autorandr by reporting it upstream.
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

The funny thing is, I didn't have an issue with this before. Some time ago I worked on an autorandr feature and I deleted my profiles because of this. I generated a new one and this new profile seems to have this issue. Maybe the order of the screens?

I know for a fact my laptop can only use three screens at once. When using xrandr, I remember having to go in a couple of steps to activate all screens.

This is the screen config:

output DP1
off
output HDMI1
off
output HDMI2
off
output VIRTUAL1
off
output eDP1
off
output DP1-1
mode 1920x1080
pos 0x0
rate 60.00
output DP1-2
mode 1920x1080
pos 1920x0
rate 60.00
output DP1-3
mode 1920x1080
pos 3840x0
rate 60.00

And this is the setup:

DP1-1 00ffffffffffff0022f02b32010101010f190104a5301b78223455a75552a027115054210800d1c081c0a9c0b3009500810081800101023a801871382d40582c4500dd0c1100001e000000fd00323c185011000a202020202020000000fc004850205032323276610a202020000000ff00434e4b353135313244340a2020006a
DP1-2 00ffffffffffff0022f02b32010101010f190104a5301b78223455a75552a027115054210800d1c081c0a9c0b3009500810081800101023a801871382d40582c4500dd0c1100001e000000fd00323c185011000a202020202020000000fc004850205032323276610a202020000000ff00434e4b353135313244300a2020006e
DP1-3 00ffffffffffff0022f02c32010101010f19010368301b782a3455a75552a027115054210800d1c081c0a9c0b3009500810081800101023a801871382d40582c4500dd0c1100001e000000fd00323c185011000a202020202020000000fc004850205032323276610a202020000000ff00434e4b353135313142500a20200086
eDP1 00ffffffffffff0030e46d040000000000180104951f1178eadc95a35855a0260d5054000000010101010101010101010101010101012e3680a070381f403020350035ae1000001a522b80a070381f403020350035ae1000001a000000fe00524e39314e823134305746330a00000000000041319e001000000a010a202000e6

Any hints on what the issue might be?

X Error of failed request: BadValue (integer parameter out of range for operation)

While switching the profile with autorander, I get always the following error message X Error of failed request: BadValue (integer parameter out of range for operation).

It seems to work, but here is the complete output.

System information
OS: Ubuntu GNOME 15.10
Device: Lenovo Thinkpad T440p
Graphiccard: NVIDIA GeForce GT 730M
Grapic Driver: Nvidia Binary 352.41

Loading moible

~$ autorandr --load mobile
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  26 (RRSetCrtcTransform)
  Value in failed request:  0x40
  Serial number of failed request:  45
  Current serial number in output stream:  46
Failed to apply profile 'mobile' (line 590):
  Command failed: xrandr --output DisplayPort-1-3 --off --output eDP-1-0 --gamma 1.0:1.0:1.0 --mode 1920x1080 --panning 0x0 --pos 0x0 --primary --rate 60.05 --reflect normal --rotate normal --transform 1,0,0,0,1,0,0,0,1 (line 590)
This appears to be a bug. Please help improving autorandr by reporting it upstream.
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

Loading docked

~$ autorandr --load docked
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  26 (RRSetCrtcTransform)
  Value in failed request:  0x3f
  Serial number of failed request:  45
  Current serial number in output stream:  46
Failed to apply profile 'docked' (line 590):
  Command failed: xrandr --output eDP-1-0 --off --output DisplayPort-1-3 --gamma 1.0:1.0:1.0 --mode 1920x1080 --panning 0x0 --pos 0x0 --primary --rate 60.00 --reflect normal --rotate normal --transform 1,0,0,0,1,0,0,0,1 (line 590)
This appears to be a bug. Please help improving autorandr by reporting it upstream.
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

xrander --verbose output

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
eDP-1-0 connected (normal)
    Identifier: 0x42
    Timestamp:  77346
    Subpixel:   unknown
    Clones:    
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    _MUTTER_PRESENTATION_OUTPUT: 0 
    EDID: 
        00ffffffffffff0006af3d1300000000
        26170104951f11780287e5a456509e26
        0d505400000001010101010101010101
        010101010101143780b8703824401010
        3e0035ad100000180000000f00000000
        00000000000000000020000000fe0041
        554f0a202020202020202020000000fe
        004231343048414e30312e33200a007a
    scaling mode: Full aspect 
        supported: None, Full, Center, Full aspect
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
  1920x1080 (0x4c) 141.000MHz -HSync -VSync +preferred
        h: width  1920 start 1936 end 1952 total 2104 skew    0 clock  67.02KHz
        v: height 1080 start 1083 end 1097 total 1116           clock  60.05Hz
  1920x1080 (0x4d) 138.500MHz +HSync -VSync
        h: width  1920 start 1968 end 2000 total 2080 skew    0 clock  66.59KHz
        v: height 1080 start 1083 end 1088 total 1111           clock  59.93Hz
  1680x1050 (0x4e) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1680x1050 (0x4f) 119.000MHz +HSync -VSync
        h: width  1680 start 1728 end 1760 total 1840 skew    0 clock  64.67KHz
        v: height 1050 start 1053 end 1059 total 1080           clock  59.88Hz
  1600x1024 (0x50) 103.125MHz +HSync +VSync
        h: width  1600 start 1600 end 1656 total 1664 skew    0 clock  61.97KHz
        v: height 1024 start 1024 end 1029 total 1030           clock  60.17Hz
  1400x1050 (0x51) 122.000MHz +HSync +VSync
        h: width  1400 start 1488 end 1640 total 1880 skew    0 clock  64.89KHz
        v: height 1050 start 1052 end 1064 total 1082           clock  59.98Hz
  1280x1024 (0x52) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1440x900 (0x53) 106.500MHz -HSync +VSync
        h: width  1440 start 1520 end 1672 total 1904 skew    0 clock  55.93KHz
        v: height  900 start  903 end  909 total  934           clock  59.89Hz
  1280x960 (0x54) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1360x768 (0x55) 84.750MHz -HSync +VSync
        h: width  1360 start 1432 end 1568 total 1776 skew    0 clock  47.72KHz
        v: height  768 start  771 end  781 total  798           clock  59.80Hz
  1360x768 (0x56) 72.000MHz +HSync -VSync
        h: width  1360 start 1408 end 1440 total 1520 skew    0 clock  47.37KHz
        v: height  768 start  771 end  781 total  790           clock  59.96Hz
  1152x864 (0x57) 81.620MHz -HSync +VSync
        h: width  1152 start 1216 end 1336 total 1520 skew    0 clock  53.70KHz
        v: height  864 start  865 end  868 total  895           clock  60.00Hz
  1024x768 (0x58) 133.475MHz -HSync +VSync DoubleScan
        h: width  1024 start 1100 end 1212 total 1400 skew    0 clock  95.34KHz
        v: height  768 start  768 end  770 total  794           clock  60.04Hz
  1024x768 (0x59) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  960x720 (0x5a) 117.000MHz -HSync +VSync DoubleScan
        h: width   960 start 1024 end 1128 total 1300 skew    0 clock  90.00KHz
        v: height  720 start  720 end  722 total  750           clock  60.00Hz
  928x696 (0x5b) 109.150MHz -HSync +VSync DoubleScan
        h: width   928 start  976 end 1088 total 1264 skew    0 clock  86.35KHz
        v: height  696 start  696 end  698 total  719           clock  60.05Hz
  896x672 (0x5c) 102.400MHz -HSync +VSync DoubleScan
        h: width   896 start  960 end 1060 total 1224 skew    0 clock  83.66KHz
        v: height  672 start  672 end  674 total  697           clock  60.01Hz
  960x600 (0x5d) 77.000MHz +HSync -VSync DoubleScan
        h: width   960 start  984 end 1000 total 1040 skew    0 clock  74.04KHz
        v: height  600 start  601 end  604 total  617           clock  60.00Hz
  960x540 (0x5e) 69.250MHz +HSync -VSync DoubleScan
        h: width   960 start  984 end 1000 total 1040 skew    0 clock  66.59KHz
        v: height  540 start  541 end  544 total  555           clock  59.99Hz
  800x600 (0x5f) 81.000MHz +HSync +VSync DoubleScan
        h: width   800 start  832 end  928 total 1080 skew    0 clock  75.00KHz
        v: height  600 start  600 end  602 total  625           clock  60.00Hz
  800x600 (0x60) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x61) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  840x525 (0x62) 73.125MHz -HSync +VSync DoubleScan
        h: width   840 start  892 end  980 total 1120 skew    0 clock  65.29KHz
        v: height  525 start  526 end  529 total  544           clock  60.01Hz
  840x525 (0x63) 59.500MHz +HSync -VSync DoubleScan
        h: width   840 start  864 end  880 total  920 skew    0 clock  64.67KHz
        v: height  525 start  526 end  529 total  540           clock  59.88Hz
  800x512 (0x64) 51.562MHz +HSync +VSync DoubleScan
        h: width   800 start  800 end  828 total  832 skew    0 clock  61.97KHz
        v: height  512 start  512 end  514 total  515           clock  60.17Hz
  700x525 (0x65) 61.000MHz +HSync +VSync DoubleScan
        h: width   700 start  744 end  820 total  940 skew    0 clock  64.89KHz
        v: height  525 start  526 end  532 total  541           clock  59.98Hz
  640x512 (0x66) 54.000MHz +HSync +VSync DoubleScan
        h: width   640 start  664 end  720 total  844 skew    0 clock  63.98KHz
        v: height  512 start  512 end  514 total  533           clock  60.02Hz
  720x450 (0x67) 53.250MHz -HSync +VSync DoubleScan
        h: width   720 start  760 end  836 total  952 skew    0 clock  55.93KHz
        v: height  450 start  451 end  454 total  467           clock  59.89Hz
  640x480 (0x68) 54.000MHz +HSync +VSync DoubleScan
        h: width   640 start  688 end  744 total  900 skew    0 clock  60.00KHz
        v: height  480 start  480 end  482 total  500           clock  60.00Hz
  640x480 (0x69) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  680x384 (0x6a) 42.375MHz -HSync +VSync DoubleScan
        h: width   680 start  716 end  784 total  888 skew    0 clock  47.72KHz
        v: height  384 start  385 end  390 total  399           clock  59.80Hz
  680x384 (0x6b) 36.000MHz +HSync -VSync DoubleScan
        h: width   680 start  704 end  720 total  760 skew    0 clock  47.37KHz
        v: height  384 start  385 end  390 total  395           clock  59.96Hz
  576x432 (0x6c) 40.810MHz -HSync +VSync DoubleScan
        h: width   576 start  608 end  668 total  760 skew    0 clock  53.70KHz
        v: height  432 start  432 end  434 total  447           clock  60.06Hz
  512x384 (0x6d) 32.500MHz -HSync -VSync DoubleScan
        h: width   512 start  524 end  592 total  672 skew    0 clock  48.36KHz
        v: height  384 start  385 end  388 total  403           clock  60.00Hz
  400x300 (0x6e) 20.000MHz +HSync +VSync DoubleScan
        h: width   400 start  420 end  484 total  528 skew    0 clock  37.88KHz
        v: height  300 start  300 end  302 total  314           clock  60.32Hz
  400x300 (0x6f) 18.000MHz +HSync +VSync DoubleScan
        h: width   400 start  412 end  448 total  512 skew    0 clock  35.16KHz
        v: height  300 start  300 end  301 total  312           clock  56.34Hz
  320x240 (0x70) 12.587MHz -HSync -VSync DoubleScan
        h: width   320 start  328 end  376 total  400 skew    0 clock  31.47KHz
        v: height  240 start  245 end  246 total  262           clock  60.05Hz
VGA-1-0 disconnected (normal)
    Identifier: 0x43
    Timestamp:  77346
    Subpixel:   unknown
    Clones:    
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
DisplayPort-1-0 disconnected (normal)
    Identifier: 0x44
    Timestamp:  77346
    Subpixel:   unknown
    Clones:     HDMI-1-0
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
HDMI-1-0 disconnected (normal)
    Identifier: 0x45
    Timestamp:  77346
    Subpixel:   unknown
    Clones:     DisplayPort-1-0
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    aspect ratio: Automatic 
        supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
DisplayPort-1-1 disconnected (normal)
    Identifier: 0x46
    Timestamp:  77346
    Subpixel:   unknown
    Clones:     HDMI-1-1
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
HDMI-1-1 disconnected (normal)
    Identifier: 0x47
    Timestamp:  77346
    Subpixel:   unknown
    Clones:     DisplayPort-1-1
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    aspect ratio: Automatic 
        supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
DisplayPort-1-2 disconnected (normal)
    Identifier: 0x48
    Timestamp:  77346
    Subpixel:   unknown
    Clones:    
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
DisplayPort-1-3 connected primary 1920x1080+0+0 (0x71) normal (normal) 521mm x 293mm
    Identifier: 0x49
    Timestamp:  77346
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:    
    CRTC:       0
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    _MUTTER_PRESENTATION_OUTPUT: 0 
    EDID: 
        00ffffffffffff004c2de80900000000
        18160104a5341d78228ee1a45750a128
        0f5054bfef80714f81c0810081809500
        a9c0b3000101023a801871382d40582c
        450009252100001e011d007251d01e20
        6e28550009252100001e000000fd0032
        4b1e5111000a202020202020000000fc
        00533234433635300a202020202001d6
        020313c14604130312901f2309070783
        010000011d00bc52d01e20b828554009
        252100001e8c0ad090204031200c4055
        000925210000188c0ad08a20e02d1010
        3e960009252100001800000000000000
        00000000000000000000000000000000
        00000000000000000000000000000000
        00000000000000000000000000000005
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on
  1920x1080 (0x71) 148.500MHz +HSync +VSync *current +preferred
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
  1920x1080 (0x72) 148.500MHz +HSync +VSync
        h: width  1920 start 2448 end 2492 total 2640 skew    0 clock  56.25KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  50.00Hz
  1920x1080 (0x73) 148.352MHz +HSync +VSync
        h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.43KHz
        v: height 1080 start 1084 end 1089 total 1125           clock  59.94Hz
  1680x1050 (0x4e) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1600x900 (0x74) 108.000MHz +HSync +VSync
        h: width  1600 start 1624 end 1704 total 1800 skew    0 clock  60.00KHz
        v: height  900 start  901 end  904 total 1000           clock  60.00Hz
  1280x1024 (0x75) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x52) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1440x900 (0x53) 106.500MHz -HSync +VSync
        h: width  1440 start 1520 end 1672 total 1904 skew    0 clock  55.93KHz
        v: height  900 start  903 end  909 total  934           clock  59.89Hz
  1280x800 (0x76) 83.500MHz -HSync +VSync
        h: width  1280 start 1352 end 1480 total 1680 skew    0 clock  49.70KHz
        v: height  800 start  803 end  809 total  831           clock  59.81Hz
  1152x864 (0x77) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  1280x720 (0x78) 74.250MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
        v: height  720 start  725 end  730 total  750           clock  60.00Hz
  1280x720 (0x79) 74.250MHz +HSync +VSync
        h: width  1280 start 1720 end 1760 total 1980 skew    0 clock  37.50KHz
        v: height  720 start  725 end  730 total  750           clock  50.00Hz
  1280x720 (0x7a) 74.176MHz +HSync +VSync
        h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  44.96KHz
        v: height  720 start  725 end  730 total  750           clock  59.94Hz
  1024x768 (0x7b) 78.800MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.06KHz
        v: height  768 start  769 end  772 total  800           clock  75.08Hz
  1024x768 (0x7c) 75.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1328 skew    0 clock  56.48KHz
        v: height  768 start  771 end  777 total  806           clock  70.07Hz
  1024x768 (0x59) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  832x624 (0x7d) 57.284MHz -HSync -VSync
        h: width   832 start  864 end  928 total 1152 skew    0 clock  49.73KHz
        v: height  624 start  625 end  628 total  667           clock  74.55Hz
  800x600 (0x7e) 50.000MHz +HSync +VSync
        h: width   800 start  856 end  976 total 1040 skew    0 clock  48.08KHz
        v: height  600 start  637 end  643 total  666           clock  72.19Hz
  800x600 (0x7f) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x60) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x61) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  720x576 (0x80) 27.000MHz -HSync -VSync
        h: width   720 start  732 end  796 total  864 skew    0 clock  31.25KHz
        v: height  576 start  581 end  586 total  625           clock  50.00Hz
  720x480 (0x81) 27.027MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.50KHz
        v: height  480 start  489 end  495 total  525           clock  60.00Hz
  720x480 (0x82) 27.000MHz -HSync -VSync
        h: width   720 start  736 end  798 total  858 skew    0 clock  31.47KHz
        v: height  480 start  489 end  495 total  525           clock  59.94Hz
  640x480 (0x83) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x84) 31.500MHz -HSync -VSync
        h: width   640 start  664 end  704 total  832 skew    0 clock  37.86KHz
        v: height  480 start  489 end  491 total  520           clock  72.81Hz
  640x480 (0x85) 30.240MHz -HSync -VSync
        h: width   640 start  704 end  768 total  864 skew    0 clock  35.00KHz
        v: height  480 start  483 end  486 total  525           clock  66.67Hz
  640x480 (0x86) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  640x480 (0x69) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  720x400 (0x87) 28.320MHz -HSync +VSync
        h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
        v: height  400 start  412 end  414 total  449           clock  70.08Hz
DisplayPort-1-4 disconnected (normal)
    Identifier: 0x4a
    Timestamp:  77346
    Subpixel:   unknown
    Clones:    
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    Broadcast RGB: Automatic 
        supported: Automatic, Full, Limited 16:235
    audio: auto 
        supported: force-dvi, off, auto, on

/etc/pm/sleep.d/40autorandr fails when run from udev

When I plug my laptop, running Ubuntu 16.10 and autorandr (from git, installed from debian package version 1.0-16-g855c18b), the screens are not automatically initialized, I have to run autorandr -c manually.

The fault seems to be that /etc/pm/sleep.d/40autorandr tries to write to /var/log/autorandr.log

Mar  6 07:44:08 besserwisser systemd-udevd[8975]: starting '/etc/pm/sleep.d/40autorandr thaw udev'
Mar  6 07:44:08 besserwisser systemd-udevd[8974]: '/etc/pm/sleep.d/40autorandr thaw udev'(err) '/etc/pm/sleep.d/40autorandr: 4: /etc/pm/sleep.d/40autorandr: cannot create /var/log/autorandr.log: Read-only file system'
Mar  6 07:44:08 besserwisser systemd-udevd[8974]: Process '/etc/pm/sleep.d/40autorandr thaw udev' failed with exit code 2.

This is when it's triggered by the udev rule.

I'm confused about what user is actually effective when running that script. Trying to write to /tmp/autorandr.log had the same error.

Removing the line which tries to log to /var/log/autorandr.log makes everything work, and stdout from autorandr is available in syslog (written there by systemd).

Parsing XRandR output failed

autorandr has stopped working for me with the latest git version (r168.93e5266-1).

Here's some output from a console session:

%autorandr --help

Traceback (most recent call last):
  File "/usr/bin/autorandr", line 624, in main
    profiles.update(load_profiles(profile_path))
  File "/usr/bin/autorandr", line 406, in load_profiles
    config[buffer[0].strip().split()[-1]] = XrandrOutput.from_config_file(edids, "".join(buffer))
  File "/usr/bin/autorandr", line 318, in from_config_file
    raise AutorandrException("Failed to find an EDID for output `%s' in setup file, required as `%s' is not off in config file." % (options["output"], options["output"]))
__main__.AutorandrException: Failed to find an EDID for output `VIRTUAL1' in setup file, required as `VIRTUAL1' is not off in config file. (line 318)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/autorandr", line 712, in <module>
    main(sys.argv)
  File "/usr/bin/autorandr", line 628, in main
    raise AutorandrException("Failed to load profiles", e)
__main__.AutorandrException
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/autorandr", line 715, in <module>
    print(e, file=sys.stderr)
  File "/usr/bin/autorandr", line 100, in __str__
    retval.append(":\n  " % self.line)
TypeError: not all arguments converted during string formatting

Okay, lets remove the autorandr profiles directory and try again:

% rm -r .autorandr/
% autorandr --help

Parsing XRandR output failed, 6621 bytes left unmatched after regular expression, starting at byte 598 with ..'VIRTUAL1.6'. (line 239)
This appears to be a bug. Please help improving autorandr by reporting it upstream.
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

Hence, this bug report :)

Here's the output asked for:

% xrandr --verbose
Screen 0: minimum 8 x 8, current 3200 x 1080, maximum 32767 x 32767
LVDS1 connected 1920x1080+0+0 (0x47) normal (normal left inverted right x axis y axis) 344mm x 194mm
    Identifier: 0x43
    Timestamp:  84094863
    Subpixel:   horizontal rgb
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:    
    CRTC:       0
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
        00ffffffffffff004ca34c3100000000
        0015010380221378ea2de59d5c4e9a27
        1a505400000001010101010101010101
        010101010101293680a070381f401810
        250058c2100000190000000f00000000
        0000000000285a0a3c00000000fe0053
        414d53554e470a2020202020000000fe
        00313536485430312d3230310a20004e
    BACKLIGHT: 10 
        range: (0, 10)
    Backlight: 10 
        range: (0, 10)
    scaling mode: Full aspect 
        supported: None, Full, Center, Full aspect
  1920x1080 (0x47) 138.650MHz -HSync -VSync *current +preferred
        h: width  1920 start 1944 end 1960 total 2080 skew    0 clock  66.66KHz
        v: height 1080 start 1082 end 1087 total 1111           clock  60.00Hz
  1400x1050 (0xc6) 122.000MHz +HSync +VSync
        h: width  1400 start 1488 end 1640 total 1880 skew    0 clock  64.89KHz
        v: height 1050 start 1052 end 1064 total 1082           clock  59.98Hz
  1280x1024 (0xc7) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x960 (0xc8) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  1024x768 (0xc9) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0xca) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0xcb) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  640x480 (0xcc) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
VGA1 connected 1280x1024+1920+0 (0xc7) normal (normal left inverted right x axis y axis) 376mm x 301mm
    Identifier: 0x44
    Timestamp:  84094863
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:    
    CRTC:       1
    CRTCs:      0 1 2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
        00ffffffffffff0010ac25404c334830
        1a1201030e261e78eeee91a3544c9926
        0f5054a54b00714f8180010101010101
        010101010101302a009851002a403070
        1300782d1100001e000000ff00473331
        364838364f3048334c0a000000fc0044
        454c4c203139303846500a20000000fd
        00384c1f530e000a2020202020200061
  1280x1024 (0xc7) 108.000MHz +HSync +VSync *current +preferred
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x1024 (0x153) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1152x864 (0x154) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  1024x768 (0x155) 78.800MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.06KHz
        v: height  768 start  769 end  772 total  800           clock  75.08Hz
  1024x768 (0xc9) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x156) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0xca) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  640x480 (0x157) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x158) 25.200MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
        v: height  480 start  490 end  492 total  525           clock  60.00Hz
  720x400 (0x159) 28.320MHz -HSync +VSync
        h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
        v: height  400 start  412 end  414 total  449           clock  70.08Hz
VIRTUAL1 connected (normal left inverted right x axis y axis)
    Identifier: 0x45
    Timestamp:  84094863
    Subpixel:   no subpixels
    Clones:     VIRTUAL2
    CRTCs:      3 4
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
        00ffffffffffff0009d1db76f7200000
        2e11010380342178ea5ad5a7564b9b24
        135054bdef80714f81908180818ca940
        b30001010101283c80a070b023403020
        360007442100001ed50980a0205e6310
        10605208782d1100001a000000fd0038
        4c1e5311000a202020202020000000fc
        0042656e5120323431570a202020006b
  VIRTUAL1.639-1920x1200 (0xcd) 154.000MHz +HSync +VSync
        h: width  1920 start 1968 end 2000 total 2080 skew    0 clock  74.04KHz
        v: height 1200 start 1203 end 1209 total 1235           clock  59.95Hz
  VIRTUAL1.640-1680x1050 (0xce) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  VIRTUAL1.641-1600x1200 (0xcf) 162.000MHz +HSync +VSync
        h: width  1600 start 1664 end 1856 total 2160 skew    0 clock  75.00KHz
        v: height 1200 start 1201 end 1204 total 1250           clock  60.00Hz
  VIRTUAL1.642-1400x1050 (0xd0) 155.800MHz +HSync +VSync
        h: width  1400 start 1464 end 1784 total 1912 skew    0 clock  81.49KHz
        v: height 1050 start 1052 end 1064 total 1090           clock  74.76Hz
  1400x1050 (0xc6) 122.000MHz +HSync +VSync
        h: width  1400 start 1488 end 1640 total 1880 skew    0 clock  64.89KHz
        v: height 1050 start 1052 end 1064 total 1082           clock  59.98Hz
  VIRTUAL1.644-1280x1024 (0xd1) 141.820MHz -HSync +VSync
        h: width  1280 start 1376 end 1512 total 1744 skew    0 clock  81.32KHz
        v: height 1024 start 1025 end 1028 total 1070           clock  76.00Hz
  VIRTUAL1.645-1280x1024 (0xd2) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  VIRTUAL1.646-1280x1024 (0xd3) 132.750MHz -HSync +VSync
        h: width  1280 start 1368 end 1504 total 1728 skew    0 clock  76.82KHz
        v: height 1024 start 1025 end 1028 total 1067           clock  72.00Hz
  1280x1024 (0xc7) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1280x960 (0xc8) 108.000MHz +HSync +VSync
        h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
        v: height  960 start  961 end  964 total 1000           clock  60.00Hz
  VIRTUAL1.649-1152x864 (0xd4) 108.000MHz +HSync +VSync
        h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
        v: height  864 start  865 end  868 total  900           clock  75.00Hz
  VIRTUAL1.650-1024x768 (0xd5) 78.750MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.02KHz
        v: height  768 start  769 end  772 total  800           clock  75.03Hz
  VIRTUAL1.651-1024x768 (0xd6) 75.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1328 skew    0 clock  56.48KHz
        v: height  768 start  771 end  777 total  806           clock  70.07Hz
  1024x768 (0xc9) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  VIRTUAL1.653-832x624 (0xd7) 57.284MHz -HSync -VSync
        h: width   832 start  864 end  928 total 1152 skew    0 clock  49.73KHz
        v: height  624 start  625 end  628 total  667           clock  74.55Hz
  VIRTUAL1.654-800x600 (0xd8) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  VIRTUAL1.655-800x600 (0xd9) 50.000MHz +HSync +VSync
        h: width   800 start  856 end  976 total 1040 skew    0 clock  48.08KHz
        v: height  600 start  637 end  643 total  666           clock  72.19Hz
  800x600 (0xca) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0xcb) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  VIRTUAL1.658-700x525 (0xda) 77.900MHz +HSync +VSync DoubleScan
        h: width   700 start  732 end  892 total  956 skew    0 clock  81.49KHz
        v: height  525 start  526 end  532 total  545           clock  74.76Hz
  VIRTUAL1.659-700x525 (0xdb) 61.000MHz +HSync +VSync DoubleScan
        h: width   700 start  744 end  820 total  940 skew    0 clock  64.89KHz
        v: height  525 start  526 end  532 total  541           clock  59.98Hz
  VIRTUAL1.660-640x480 (0xdc) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  VIRTUAL1.661-640x480 (0xdd) 31.500MHz -HSync -VSync
        h: width   640 start  664 end  704 total  832 skew    0 clock  37.86KHz
        v: height  480 start  489 end  492 total  520           clock  72.81Hz
  VIRTUAL1.662-640x480 (0xde) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  696 total  832 skew    0 clock  37.86KHz
        v: height  480 start  481 end  484 total  520           clock  72.81Hz
  640x480 (0xcc) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
  VIRTUAL1.664-640x350 (0xdf) 25.170MHz +HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.46KHz
        v: height  350 start  387 end  389 total  449           clock  70.07Hz
  VIRTUAL1.665-512x384 (0xe0) 37.500MHz -HSync -VSync DoubleScan
        h: width   512 start  524 end  592 total  664 skew    0 clock  56.48KHz
        v: height  384 start  385 end  388 total  403           clock  70.07Hz
  VIRTUAL1.666-512x384 (0xe1) 32.500MHz -HSync -VSync DoubleScan
        h: width   512 start  524 end  592 total  672 skew    0 clock  48.36KHz
        v: height  384 start  385 end  388 total  403           clock  60.00Hz
  VIRTUAL1.667-400x300 (0xe2) 25.000MHz +HSync +VSync DoubleScan
        h: width   400 start  428 end  488 total  520 skew    0 clock  48.08KHz
        v: height  300 start  318 end  321 total  333           clock  72.19Hz
  VIRTUAL1.668-320x240 (0xe3) 15.750MHz -HSync -VSync DoubleScan
        h: width   320 start  332 end  352 total  416 skew    0 clock  37.86KHz
        v: height  240 start  244 end  246 total  260           clock  72.81Hz
  VIRTUAL1.669-320x240 (0xe4) 12.587MHz -HSync -VSync DoubleScan
        h: width   320 start  328 end  376 total  400 skew    0 clock  31.47KHz
        v: height  240 start  245 end  246 total  262           clock  60.05Hz
VIRTUAL2 disconnected (normal left inverted right x axis y axis)
    Identifier: 0xc5
    Timestamp:  84094863
    Subpixel:   no subpixels
    Clones:     VIRTUAL1
    CRTCs:      3 4
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 

Hope this is helpful.

What license does this software use?

I'm assuming everything in this repository is open source/copy-left like GPLv2 or GPLv3, but it doesn't seem to indicate explicitly. Neither this repo, nor its predecessor, https://github.com/wertarbyte/autorandr, nor any references to autorandr or autodisper return any clues.

I'm updating Arch Linux's user contributed AUR package for autorandr and noticed its license field is blank. This would greatly help in my housekeeping of that package build. Thanks!

Feature request: packaging support

I'm looking for something to replace gnome-settings-daemon's ~/.config/monitors.xml support functionality (it was moved to gnome-shell, but since I'm only using g-s-d, I need some replacement).
This fork of autorandr seems pretty much what I need, however, I do not feel comfortable with installing software from sources globally.

So the feature request is to provide automated packaging, for instance, through openSUSE Build Service or at least add commands that produce packages to Makefile.

I'm primarily interested in deb package. As the side effect some sort of versioning is needed (hopefully, http://semver.org/).

TODO: Rework disabled output handling (DisplayPort MST, hot-plug graphics)

Since the introduction of DisplayPort MST and hot-pluggable graphics cards, we can no longer assume the list of outputs is stable.
We need to implement a different logic for disabled outputs:

  • autorandr config should only contain enabled outputs
  • on config load, all other outputs should be disabled

Pyhton version does not handle unused connected displays

Thanks for keeping this project going. I started building my own Python version from scrap after realising that the wertabyte repo didn't work. (if you're in touch with him, maybe you can ask him to put a disclaimer on the top of the readme?)

Currently your python version does not work. If there's a display connected, but not currently used by xrandr, I get the current output:

LVDS1 connected (normal left inverted right x axis y axis)

However, your RegEx requires that if a display is connected, it must also have <with>x<height>+<x>+<y>, which is clearly not true.


The main point is: a display can be connected, but not in use. This means there are 3 statuses: (1) in use, (2) idle (connected but not in use), (3) disconnected.

Currently your code relies on the "off" property for most of it's logic, so this is a non-trivial change which I think is better left off to you 😄

udev rule executed too early?

After getting the udev rule to work, I am sometimes running into trouble, where disconnecting an external monitor changes the profile to external monitor, and connecting an external monitor changes the profile to only my laptop. So it's doing the opposite of what it should).

My guess is that autorandr is run too "early", such that the output of xrandr does not reflect the actual state of things.

If I have time one of the next days, I'll try to look into it.

Feature Request: Support XRandR 1.3 transformation matrix (e.g. scaling)

Case:

  • Docked laptop in the middle with a 14 inch 1920x1080 display (eDP1).
  • Two 24 inch 1920x1200 monitors on each side (DP1-1 and DP1-2).
  • Since the laptop screen is too far away to be readable with the global DPI setting, I use xrandr's "--scale" option to apply a transformation to the output, making the effective resolution smaller than the physical display mode resolution.

Proposal/TODO:

  • Change current_cfg_xrandr to parse verbose xrandr query.
  • Detect and parse transformation matrix, write "transform none" to config if "filter: " is followed by empty string or "none".
  • It should not be necessary to modify load_cfg_xrandr.

Caveats:

  • Simple output positioning ("--left-of", "--right-of" etc.) is not handled well in xrandr when transformation is in use. This should not be a problem with autorandr since we use absolute "--pos XxY", but it makes the initial setup harder for the user.

No access to xserver when started by udev

When autorandr gets triggered by udev, I get the following logs:

systemd[1]: Starting autorandr execution hook...
autorandr[1776]: No protocol specified
autorandr[1776]: Can't open display :0
autorandr[1776]: Failed to run xrandr (line 439)
autorandr[1776]: Running autorandr as timo for display :0

Looking through the autorandr source, Failed to run xrandr seems to be a misleading error message that is caused by xrandrs stdout being empty (but not it's stdr, Can't open display :0).

When I disable x access control with xhost +, everything works fine.
I'm assuming the problem is that autorandr doesn't get the XAUTHORITY variable via udev.
However, I tried to add Environment=XAUTHORITY=/home/timo/.Xauthority to the service file and `ENV{XAUTHORITY}="/home/timo/.Xauthority" to the udev rule, without success.

As an aside, why does autorandr use an system wide service file instead of systemd-user?

Laptop display doesn't have an edid

When using

autorandr --save docked

I received the "Failed to parse current configuration from XRandR" exception because the edid field is None for my integrated laptop display. You can see the output from xrandr -q --verbose for the display in question below.

I was able to fix the error by replacing this line with

            edid = match.get('edid')
            if edid is not None:
                edid = "".join(edid.strip().split())
            else:
                edid = match['output'].strip()

I don't know yet if I'm breaking other things down stream.

Here is the relevant part of the xrandr query

LVDS connected 1600x900+3840+0 (0x87) normal (normal left inverted right x axis y axis) 309mm x 174mm
    Identifier: 0x79
    Timestamp:  21166
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:    
    CRTC:       0
    CRTCs:      0 1 2 3 4 5
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    BACKLIGHT: 20 
        range: (0, 20)
    SignalFormat: DisplayPort 
    ConnectorType: Panel 
  1600x900 (0x87)  112.6MHz -HSync -VSync *current +preferred
        h: width  1600 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  900 start  903 end  906 total  926           clock   60.0Hz
  1600x900 (0x88)   75.1MHz -HSync -VSync
        h: width  1600 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  900 start  903 end  906 total  926           clock   40.0Hz
  1440x900 (0x89)  112.6MHz -HSync -VSync
        h: width  1440 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  900 start  903 end  906 total  926           clock   60.0Hz
  1440x900 (0x8a)   75.1MHz -HSync -VSync
        h: width  1440 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  900 start  903 end  906 total  926           clock   40.0Hz
  1280x768 (0x8b)  112.6MHz -HSync -VSync
        h: width  1280 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  768 start  903 end  906 total  926           clock   60.0Hz
  1280x768 (0x8c)   75.1MHz -HSync -VSync
        h: width  1280 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  768 start  903 end  906 total  926           clock   40.0Hz
  1280x720 (0x8d)  112.6MHz -HSync -VSync
        h: width  1280 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  720 start  903 end  906 total  926           clock   60.0Hz
  1280x720 (0x8e)   75.1MHz -HSync -VSync
        h: width  1280 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  720 start  903 end  906 total  926           clock   40.0Hz
  1024x768 (0x8f)  112.6MHz -HSync -VSync
        h: width  1024 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  768 start  903 end  906 total  926           clock   60.0Hz
  1024x768 (0x90)   75.1MHz -HSync -VSync
        h: width  1024 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  768 start  903 end  906 total  926           clock   40.0Hz
  1024x600 (0x91)  112.6MHz -HSync -VSync
        h: width  1024 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  600 start  903 end  906 total  926           clock   60.0Hz
  1024x600 (0x92)   75.1MHz -HSync -VSync
        h: width  1024 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  600 start  903 end  906 total  926           clock   40.0Hz
  800x600 (0x93)  112.6MHz -HSync -VSync
        h: width   800 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  600 start  903 end  906 total  926           clock   60.0Hz
  800x600 (0x94)   75.1MHz -HSync -VSync
        h: width   800 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  600 start  903 end  906 total  926           clock   40.0Hz
  800x480 (0x95)  112.6MHz -HSync -VSync
        h: width   800 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  480 start  903 end  906 total  926           clock   60.0Hz
  800x480 (0x96)   75.1MHz -HSync -VSync
        h: width   800 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  480 start  903 end  906 total  926           clock   40.0Hz
  640x480 (0x97)  112.6MHz -HSync -VSync
        h: width   640 start 1664 end 1706 total 2026 skew    0 clock   55.6KHz
        v: height  480 start  903 end  906 total  926           clock   60.0Hz
  640x480 (0x98)   75.1MHz -HSync -VSync
        h: width   640 start 1664 end 1706 total 2026 skew    0 clock   37.1KHz
        v: height  480 start  903 end  906 total  926           clock   40.0Hz

Automated testing

Would be really nice to integrate jenkins-ci or someting like that.

Would require a flag for reading the data from stdin instead of running xrandr.

can't load stored profiles

Saved current configuration as profile 'docked'
# UNDOCKED HERE
$  ./autorandr.py -s laptop
Saved current configuration as profile 'laptop'
# REDOCKED HERE
$ ./autorandr.py -l docked
Failed to load profiles (line 364):
  Failed to find an EDID for output `DP-2-1' in setup file, required as `DP-2-1' is not off```

[docked.zip](https://github.com/phillipberndt/autorandr/files/1396702/docked.zip)

4th gen Lenovo Carbon X1, running Debian Stretch.

--pos is not always applied correctly

xrandr \
 --output eDP1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --panning 0x0 --pos 0x0 \
    --primary --rate 60.0 --reflect normal --rotate normal --transform \
        0.899994,0.000000,0.000000,0.000000,0.899994,0.000000,0.000000,0.000000,1.000000 \
 --output DP1 --gamma 1.0:1.0:1.0 --mode 1920x1200 --panning 0x0 --pos 1728x0 \
   --rate 60.0 --reflect normal --rotate normal --transform 1,0,0,0,1,0,0,0,1

if DP1 was previously disabled, does not move the output to 1728x0, but to 1920x0 instead.

could not convert string to float

When executing autorandr.py --change the following error message occurs:

Failed to apply profile 'xxxx' (line 233):
  could not convert string to float: 

The output of xrandr --verbose can be found here: xrandr_verbose.txt

Thanks!

Kind regards,
Martin

Handle xrandr 1.5 monitors

xrandr 1.5 introduced support for monitor abstraction. autorandr should store and load monitor configuration as well.

This requries an extra call to xrandr, as monitors are not listed in xrandr --verbose, and combining --verbose and --listmonitors is not possible.

The --listmonitors output is generated by the code:

if (monitors) {
  int m, o;

  printf("Monitors: %d\n", monitors->n);

  for (m = 0; m < monitors->n; m++) {
    printf (" %d: %s%s%s %d/%dx%d/%d+%d+%d ",
        m,
        monitors->monitors[m].automatic ? "+" : "",
        monitors->monitors[m].primary ? "*" : "",
        XGetAtomName(dpy, monitors->monitors[m].name),
        monitors->monitors[m].width,
        monitors->monitors[m].mwidth,
        monitors->monitors[m].height,
        monitors->monitors[m].mheight,
        monitors->monitors[m].x,
        monitors->monitors[m].y);
    for (o = 0; o < monitors->monitors[m].noutput; o++) {
      output_t	*output = find_output_by_xid(monitors->monitors[m].outputs[o]);
      if (output)
        printf (" %s", output->output.string);
      else
        printf (" unknown output 0x%x\n", (CARD32) monitors->monitors[m].outputs[o]);
    }
    printf ("\n");
  }
}

and looks like this:

Monitors: 3
 0: +*eDP1 1536/309x864/174+0+0  eDP1
 1: +DP1-1 1920/518x1200/324+1536+0  DP1-1
 2: +DP1-2 1680/434x1050/270+3456+0  DP1-2

Calling --setmonitor with the already active settings does no harm. Monitors can be created by using a name which doesn't exist yet. Attempts to remove the default monitors (with their name the same as one of the output's names) result in a BadValue error. Attempts to remove a non-default monitor result in the default being recreated on the fly. An output can only be connected to a single monitor, apparently. It is possible to create monitors connected to no output though - their output will still be visible. E.g.,

$ xrandr --setmonitor eDP1-part 768/309x864/174+0+0 none
$ xrandr --setmonitor eDP1-part-2 768/309x864/174+768+0 none
$ xrandr --listmonitors
Monitors: 5
 0: +*eDP1 1536/309x864/174+0+0  eDP1
 1: eDP1-part 768/309x864/174+0+0 
 2: eDP1-part-2 768/309x864/174+768+0 
 3: +DP1-1 1920/518x1200/324+1536+0  DP1-1
 4: +DP1-2 1680/434x1050/270+3456+0  DP1-2
$ xrandr --setmonitor eDP1-part 768/154x864/174+0+0 eDP1
FAILS!
$ xrandr --delmonitor eDP1-part
$ xrandr --setmonitor eDP1 768/154x864/174+0+0 eDP1
FAILS!
$ xrandr --setmonitor eDP1-part 768/154x864/174+0+0 eDP1
$ xrandr --listmonitors
Monitors: 3
 0: eDP1-part 768/154x864/174+0+0  eDP1
 1: +DP1-1 1920/518x1200/324+1536+0  DP1-1
 2: +DP1-2 1680/434x1050/270+3456+0  DP1-2

..the dynamics seem quite complicated. We should investigate how exactly this works before implementing anything.

Handle DPI settings

I'd like to (re)store any DPI settings, which I currently set via xrandr --dpi 120.

This results in these changes in the output from xdpyinfo (from 96 to 120):

<   dimensions:    1366x768 pixels (361x203 millimeters)
<   resolution:    96x96 dots per inch

---
>   dimensions:    1366x768 pixels (289x162 millimeters)
>   resolution:    120x120 dots per inch

This does not appear to be reflected in the output of xrandr -q --verbose.

I am using xsettings now (instead of
gnome-settings-daemon), and a script to automatically set it there via
xdpyinfo (source).

However, xdpyinfo for my laptop display (Lenovo X220t) is not correct, and
therefore I set it manually.

It would be nice if this could be set per display, but apparently it's per X display (screen).

(The real DPI is 125, but I've read that you should stick to certain factors
from the default of 96 (a factor of 1.25 in this case))

Support for systemd

systemd does not use pm-utils, so autorandr is not being run after resuming.

The following could be installed into /etc/systemd/system/autorandr-resume.service:

[Unit]
Description=autorandr resume hook
After=sleep.target

[Service]
ExecStart=/etc/pm/sleep.d/40autorandr thaw

[Install]
WantedBy=sleep.target

It would also be possible to use the user's systemd instance instead, but
that part seems to in flux currently, with regard to having $DISPLAY and $XAUTHORITY available in there (https://wiki.archlinux.org/index.php/Systemd/User#Environment_variables).

Failed to parse Xrandr output

Error message when calling autorandr:
Failed to parse current configuration from XRandR:
Parsing XRandR output failed, 3826 bytes left unmatched after regular expression,starting with ..'x1050 (0xb'.

xrandr -q --verbose: http://pastebin.com/x25Amtmi

System: Fujitsu Lifebook E Series, Ubuntu 14.10 64bit, dockingstation, two Screens connected at dock (DVI, VGA)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.