Node-hide is an NPM Module that handles all the quirks of hiding and showing windows for you.
Internally node-hide uses "user32.dll" via ffi and so is, for the time being, Windows only.
Make sure you've installed all the necessary build tools for your 'node-gyp', then invoke:
$ npm install node-hide
Note: In order to compile with electron I was required to use electron-rebuild with
.\node_modules\.bin\electron-rebuild.cmd -w sqlite3 -p
var hide = require('node-hide');
var handle = hide.findWindow('Untitled - Notepad') //Track Notepad's ID to Hide it Later
hide.hideWindow(handle); //Hide Notepad, I can also take an array of handles, e.g. [1115138,331240]
setTimeout(function(){
hide.showWindow(handle); //Show Notepad After a 1 Second Timeout
},1000);
setTimeout(function(){
hide.closeWindow(handle); //close Notepad After a 5 Second Timeout
},5000);
hide.visableWindows(function(data){
console.log(JSON.stringify(data)) //List all the Visable Windows
});
//Output: {"65846":"Program Manager","132154":"Google - Google Chrome",
// "199568":"GitHub","331240":"Untitled - Notepad","1115138":"npm - Google Chrome"}
If you're having any problem, please raise an issue on GitHub.
Thanks to Shawn Rakowski for the initial help on Stack Overflow
node-hide is free Open-Source software, and is released under the GPL-3.0 License, further information can be found under the terms specified in the license.