From 50545403257391d59a7d5ba2ca53a09c5e839e78 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 11 May 2022 09:58:19 +0200 Subject: connect-screen: Add new configs and move i3 workspaces Signed-off-by: Florian Pritz --- connect-screen | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file 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 -- cgit v1.2.3-24-g4f1b