On any OS, you can use both NOTIFICATION_WM_FOCUS_IN
and NOTIFICATION_WM_FOCUS_OUT
.
Example:
func _notification(what):
match what:
MainLoop.NOTIFICATION_WM_FOCUS_OUT:
pass # Pause the game
MainLoop.NOTIFICATION_WM_FOCUS_IN:
pass # Continue game
More info: Handling quit requests