summaryrefslogtreecommitdiffstats
path: root/connect-screen
diff options
context:
space:
mode:
Diffstat (limited to 'connect-screen')
-rwxr-xr-xconnect-screen50
1 files changed, 48 insertions, 2 deletions
diff --git a/connect-screen b/connect-screen
index 8c65078..4f4403e 100755
--- a/connect-screen
+++ b/connect-screen
@@ -4,16 +4,46 @@ xrandr --output VIRTUAL1 --off
xrandr --output HDMI2 --off
xrandr --output DP1 --off
xrandr --output DP2 --off
+xrandr --output DP1-1 --off
+xrandr --output DP1-2 --off
+xrandr --output DP2-1 --off
+xrandr --output DP2-2 --off
xset r rate 250 50
has_hdmi2=$(xrandr | grep '^HDMI2 connected')
has_dp1=$(xrandr | grep '^DP1 connected')
+has_dp1_1=$(xrandr | grep '^DP1-1 connected')
+has_dp1_2=$(xrandr | grep '^DP1-2 connected')
has_dp2=$(xrandr | grep '^DP2 connected')
+has_dp2_2=$(xrandr | grep '^DP2-2 connected')
-if [[ $has_hdmi2 && $has_dp1 ]]; then
- xrandr --output DP1 --right-of eDP1 --auto
+output_left=""
+output_right=""
+
+if [[ $has_dp1_1 && $has_dp1_2 ]]; then
+ xrandr --output DP1-2 --right-of eDP1 --mode 640x480 -r 60
+ xrandr --output DP1-1 --right-of DP1-2 --mode 2560x1440 -r 60
+ xrandr --output DP1-1 --primary
+ output_left=DP1-2
+ output_right=DP1-1
+elif [[ $has_hdmi2 && $has_dp1_2 ]]; then
+ xrandr --output DP1-2 --right-of eDP1 --auto
+ xrandr --output HDMI2 --right-of DP1-2 --auto
+ xrandr --output DP1-2 --primary
+ output_left=DP1-2
+ output_right=HDMI2
+elif [[ $has_hdmi2 && $has_dp1 ]]; then
+ xrandr --output DP1-1 --right-of eDP1 --auto
xrandr --output HDMI2 --right-of DP1 --auto
xrandr --output DP1 --primary
+ output_left=DP1-1
+ output_right=HDMI2
+elif [[ $has_dp1 && $has_dp2_2 ]]; then
+ xrandr --output DP2-2 --right-of eDP1 --auto
+ xrandr --output DP1 --right-of DP2-2 --auto
+ xrandr --output DP2-2 --primary
+ output_left=DP2-2
+ output_right=DP1
else
if [[ $has_hdmi2 ]]; then
xrandr --output HDMI2 --right-of eDP1 --auto
@@ -31,3 +61,19 @@ else
fi
xkbcomp .xkbmap "$DISPLAY"
+
+# Reorganize workspaces across displays
+if [[ $output_left != "" ]] && [[ $output_right != "" ]]; then
+ workspaces_left=(3 4)
+ workspaces_right=(1 2 5 6 7 8 9 10 11 12 13 14 15)
+ for workspace in "${workspaces_left[@]}"; do
+ i3-msg "[workspace=\"$workspace\"]" move workspace to output $output_left
+ done
+
+ for workspace in "${workspaces_right[@]}"; do
+ i3-msg "[workspace=\"$workspace\"]" move workspace to output $output_right
+ done
+
+ i3-msg "workspace 3"
+ i3-msg "workspace 1"
+fi