Skip to content

Instantly share code, notes, and snippets.

@riteshshrv
Forked from rosshadden/mon.sh
Created July 23, 2019 07:45
Show Gist options
  • Save riteshshrv/a8fc20db81b3e5812ef6c4baac7420fa to your computer and use it in GitHub Desktop.
Save riteshshrv/a8fc20db81b3e5812ef6c4baac7420fa 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