The behaviour of focus on one's desktop can be governed by policies in window management.
Another common policy on Unix systems using X Window System (X11) is the "focus follows mouse" policy (or FFM), where the focus automatically follows the current placement of the pointer.