#!/bin/bash xrandr --output VIRTUAL1 --off xrandr --output HDMI2 --off xrandr --output DP1 --off xrandr --output DP2 --off xset r rate 250 50 has_hdmi2=$(xrandr | grep '^HDMI2 connected') has_dp1=$(xrandr | grep '^DP1 connected') has_dp2=$(xrandr | grep '^DP2 connected') if [[ $has_hdmi2 && $has_dp1 ]]; then xrandr --output DP1 --right-of eDP1 --auto xrandr --output HDMI2 --right-of DP1 --auto else if [[ $has_hdmi2 ]]; then xrandr --output HDMI2 --right-of eDP1 --auto fi if [[ $has_dp1 ]]; then xrandr --output DP1 --right-of eDP1 --auto fi if [[ $has_dp2 ]]; then xrandr --output DP2 --right-of eDP1 --auto fi fi xkbcomp .xkbmap "$DISPLAY"