Switch to next desktop that has actual window instead of switching to empty one

This was duplicate of another post that I made.

solution I made.