Skip to content

Instantly share code, notes, and snippets.

@rosshadden
Created May 12, 2017 14:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rosshadden/f3847cc05b64545c2b872edde8e5a43c to your computer and use it in GitHub Desktop.
Save rosshadden/f3847cc05b64545c2b872edde8e5a43c to your computer and use it in GitHub Desktop.
Mixed non/HiDPI monitors in X
#!/usr/bin/env bash
numDisplays=$(xrandr --current | grep '\bconnected' | wc -l)
outputs="--output eDP1 --primary --mode 2880x1620 --pos 2880x0 --dpi 96 --scale 1x1"
xrandr --output HDMI1 --off
xrandr --output DP2 --off
if xrandr | grep "HDMI1 connected"; then
outputs+=" --output HDMI1 --auto --mode 1920x1080 --pos 0x0 --right-of eDP1 --scale 1.5x1.5"
fi
if xrandr | grep "DP2 connected"; then
outputs+=" --output DP2 --auto --mode 1920x1080 --pos 5760x0 --left-of eDP1 --scale 1.5x1.5"
fi
xrandr $outputs
if xrandr | grep "HDMI1 connected"; then
xrandr --output HDMI1 --pos 0x0
xrandr --output eDP1 --pos 2880x0
if xrandr | grep "DP2 connected"; then
xrandr --output DP2 --pos 5760x0
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment