Howto xrandr ============ List available displays and resolutions --------------------------------------- xrandr List monitors ------------- xrandr --listmonitors Get number of all connected monitors and write it to variable ------------------------------------------------------------- xrandr --listmontors NOMON="$(xrandr --listmonitors | awk 'NR==1{print substr($2,1,1)}')" Get all recommended resolution and write them to variable --------------------------------------------------------- xrandr | grep "*" | awk '{print $1}' RESOLUTIONS=$(xrandr | grep "*" | awk '{print $1}') Get actual resolution --------------------- xrandr | grep "+" Get all monitornames and write them to variable ----------------------------------------------- xrandr --listmonitors | awk '{print $4}' MONITORS=$(xrandr --listmonitors | awk '{print $4}') Switch on display if available and set maximum resolution --------------------------------------------------------- xrandr --output LVDS --auto Clone screens ------------- xrandr --output LVDS-0 --auto --output VGA-0 --auto --same-as LVDS-0 Split screens ------------- xrandr --output LVDS-0 --primary xrandr --auto --output VGA-0 --mode 1920x1080 --right-of LVDS-0 Set layout on X-Start --------------------- .xinitrc: ############################### # Set Resolution to 1680x1050 # ############################### xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync xrandr --addmode DVI-I-0 1680x1050_60.00 xrandr --output DVI-I-0 --mode 1680x1050_60.00 Configuration example --------------------- default.sh: xrandr --output eDP-1 --auto --output DP-2-2 --auto --same-as eDP-1 Call in i3-config ----------------- exec sh ~/.screenlayout/default.sh