4. Switch to another workspace. At this point Emacs thinks neither frame is visible (I'm guessing they're all iconified). I know this because in my customised compilation-finish-functions I do a notifications-notify for long-running compilations, but only if the compilation BUF does not satisfy (get-buffer-window BUF 'visible). 5. Switch back to the workspace with Emacs. 6. Repeat steps 2-3.