Skip to content

Instantly share code, notes, and snippets.

@trougnouf
Created January 4, 2019 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trougnouf/9af826831fa9364c2657d2e05a9187c8 to your computer and use it in GitHub Desktop.
Save trougnouf/9af826831fa9364c2657d2e05a9187c8 to your computer and use it in GitHub Desktop.
Set multimonitor with multi-dpi with xrandr (eg NVidia cards)
# eg: bash /orb/Dev/BashScripts/setres.sh 125 200
# Set multimonitor with multi-dpi with xrandr (eg NVidia cards)
# First set the scaling to something at least large enough (s.a. 200% in GNOME)
# In this case DVI-D-0 and HDMI-0 are 1080p monitors around DP-0 which is a 4K monitor
SCALE1=$(expr $1/100 | bc -l)
SCALE2=$(expr $2/100 | bc -l)
xrandr --output DVI-D-0 --mode 1920x1080 --panning $((1920*$2/100))x$((1080*$2/100))+$((1920*$2/100+3840*$1/100))+0 --pos 5760x0 --rotate normal --scale ${SCALE2}x${SCALE2} --output HDMI-0 --mode 1920x1080 --pos 0x0 --panning $((1920*$2/100))x$((1080*$2/100)) --rotate normal --scale ${SCALE2}x${SCALE2} --output DP-5 --off --output DP-4 --off --output DP-3 --off --output DP-2 --off --output DP-1 --off --output DP-0 --primary --mode 3840x2160 --panning $((3840*$1/100))x$((2160*$1/100))+$((1920*$2/100))+0 --pos 1920x0 --rotate normal --scale ${SCALE1}x${SCALE1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment