Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions autorandr
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down