Set ordered outputs to extend side-by-side
xrandr | grep " connected " | awk ' { print$1 }' | awk ' {if (prev) printf " --output %s --auto --right-of %s", $0, prev;else printf "xrandr --output %s --auto --primary", $0;prev=$0}' | xargs -L 1 -I {} sh -c " {}"
i3 menu
# display menu
set $mode_display (e) extend (m) mirror
mode "$mode_display" {
bindsym e exec --no-startup-id "xrandr | grep \\" connected \\" | awk '{ print$1 }' | awk '{if (prev) printf \\" --output %s --auto --right-of %s\\", $0, prev;else printf \\"xrandr --output %s --auto --primary\\", $0;prev=$0}' | xargs -L 1 -I {} sh -c \\"{}\\"", mode "default"
bindsym m exec --no-startup-id "xrandr | grep \\" connected \\" | awk '{ print$1 }' | awk '{if (prev) printf \\" --output %s --auto --pos 0x0\\", $0, prev;else printf \\"xrandr --output %s --auto --primary --pos 0x0\\", $0;prev=$0}' | xargs -L 1 -I {} sh -c \\"{}\\"", mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+shift+d mode "$mode_display"