summaryrefslogtreecommitdiffstats
path: root/connect-screen
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2020-04-01 09:32:11 +0200
committerFlorian Pritz <bluewind@xinu.at>2020-04-01 09:32:11 +0200
commitd6111c5f6209326cc30a49b4d96278e862262e62 (patch)
tree2a96de72f8e766675047852730547eb4e6622e82 /connect-screen
parent2ec51a5552cff73c1c5d2ae8caaeeaf543730013 (diff)
downloadbin-d6111c5f6209326cc30a49b4d96278e862262e62.tar.gz
bin-d6111c5f6209326cc30a49b4d96278e862262e62.tar.xz
connect-screen: Support multiple displays
Signed-off-by: Florian Pritz <bluewind@xinu.at>
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"