In any case, after you tried so many options and migrated to NSWorkspace, I found a way by which we can achieve this, this notification
"NSWorkspaceActiveSpaceDidChangeNotification"
Apple doc says "Added when a change of spaces occurred." therefore we can register for this. along with this we need to use the NSWindow property "isOnActiveSpace", so we can detect when the application enters and exits full-screen mode.
source share