Add more code to handle MIME type.
Adjust window collection behavior.

Only move to active space if window is hidden, which is similar to
built-in Mail app.