Right now I open launch firefox like this:
var exe = FileUtils.getFile('XREExeF', []); //this gives path to executable
var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
process.init(exe);
var args = ['-P', profName, '-no-remote']; //-new-instance
if (url) {
args.push('about:home');
args.push(url);
}
process.run(false, args, args.length);
This launches it in the foreground.
I would like to launch it into background and then focus it after like 5 seconds. (aside: in my feature right now it launches when user clicks "Create New Profile" but while its creating/launching I want to allow them to name the profile while its working in background, then when user finishes rename by pressing enter or escape/blur then it should focus)
Is this delayed focus possible without js-ctypes?
If I resort to js-ctypes i was thinking get the pid
attribute from the run
and then move it to background and then focus it later. But a problem happens in that I can't move it to background with winapi, and I don't know about other os'es. (mdn says pid
may not be available on all os'es, is it avail on mac and linux?)