summaryrefslogtreecommitdiffstats
path: root/connect-screen
diff options
context:
space:
mode:
Diffstat (limited to 'connect-screen')
-rwxr-xr-xconnect-screen23
1 files changed, 21 insertions, 2 deletions
diff --git a/connect-screen b/connect-screen
index cc1545d..58fa6cd 100755
--- a/connect-screen
+++ b/connect-screen
@@ -2,10 +2,29 @@
xrandr --output VIRTUAL1 --off
xrandr --output HDMI2 --off
+xrandr --output DP1 --off
+xrandr --output DP2 --off
xset r rate 250 50
-if xrandr | grep -q '^HDMI2 connected'; then
- xrandr --output HDMI2 --right-of eDP1 --auto
+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"