This repo contains 2 scripts
i3autoXrandrMemory.sh is more complex. You add a udev rule for it, and it will auto move your workspaces off of, and then BACK ONTO a monitor when you unplug and plug in monitors and run xrandr commands (configurable)
monWkspcCycle.sh is less complex. When you trigger it, it moves the current workspace to the next active monitor output
Usage information and instructions for both scripts are inside the scripts.