Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
:-)

Benoit Brummer trougnouf

💭
:-)
View GitHub Profile
@trougnouf
trougnouf / setres.sh
Created Jan 4, 2019
Set multimonitor with multi-dpi with xrandr (eg NVidia cards)
View setres.sh
# 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}