I had a problem: I wanted to be able to check websites and procrastinate while flying long distances in Elite, but when the browser had focus I couldn't adjust my course or react to an interdiction and moving the mouse back to the game window and clicking took precious seconds. This has led to more than a few loops of shame and a suntan that only progenitor cells can clear up.
There are some very good reasons why a program that doesn't have focus should ignore inputs, so lets ignore those. This script runs in the background and checks every 100ms to see if your first input device has moved by more than 10% on the XY of the stick or throttle OR if you have pressed button 1 through 19. If you have, Elite is given focus. No inputs are sent to the game from this script and nothing needs to be rebound.
I use Win10 and borderless windowed mode on a dual-screen setup so I'm not sure how well this'll work for you fullscreen Win7 diehards (and Mac is right out). Adding buttons beyond 19 is easy if you really need that, as is removing buttons you want to specifically ignore. Checking axis or buttons on more than one input device should be possible but AHK doesn't seem to have a catch-all "joystick input happened" trigger that I can find so again that's a manual job.
tl;dr alt-tab away from the game while flying with no worries.