Or the right way: fund invention process publicly (like e.g. the university research system) and then require that all publicly funded work be fully disclosed to the public. Also require that every good made available for sale (no matter who and how invented it) be fully described (including schematics, source code, and operating principle) in freely publicly available document.
This way you have a stream of inventions on-going and no issues with losing the ideas to secrecy. Further, every good on the market is a commodity from the moment of availability and the consumer gets the benefit of price competition right away.