On macOS, I use a free app called Fluor, that lets me auto switch the Fn key behavior based on which app is active.