From c9d834737fd6972dea3bc2acdd256ca6953f063f Mon Sep 17 00:00:00 2001 From: John Coulter Date: Thu, 13 Dec 2012 14:20:09 -0700 Subject: [PATCH] Disable all displays before attempting to call xrandr. Workaround for error "cannot find crtc for output". See https://bugs.freedesktop.org/show_bug.cgi?id=22539 and https://bugs.freedesktop.org/show_bug.cgi?id=29929 --- autorandr | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/autorandr b/autorandr index c14f5cb..4165bc9 100755 --- a/autorandr +++ b/autorandr @@ -164,6 +164,13 @@ config_equal() { } load_cfg_xrandr() { + # Disable all displays first. There is a bug in xrandr where trying to enable a different display + # when two displays are already attached gives the error "cannot find crtc for output" even + # when --off was passed to disable existing displays. If --off is called first as a separate + # command the crtcs are freed up for use. + # https://bugs.freedesktop.org/show_bug.cgi?id=22539 + # https://bugs.freedesktop.org/show_bug.cgi?id=29929 + $XRANDR | grep -P '(^[^ ]+) (dis)?connected' | sed -r 's/(^[^ ]+).*/--output \1 --off/' | xargs $XRANDR sed 's!^!--!' "$1" | xargs $XRANDR }