Focus window in command line handler
This commit is contained in:
parent
a8631f760a
commit
00fdeb3bf9
|
@ -80,14 +80,19 @@ ZoteroCommandLineHandler.prototype = {
|
|||
if(param) {
|
||||
var uri = cmdLine.resolveURI(param);
|
||||
if(uri.schemeIs("zotero")) {
|
||||
// Don't open a new window
|
||||
// Check for existing window and focus it
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
if(win) {
|
||||
cmdLine.preventDefault = true;
|
||||
|
||||
win.focus();
|
||||
Components.classes["@mozilla.org/network/protocol;1?name=zotero"]
|
||||
.createInstance(Components.interfaces.nsIProtocolHandler).newChannel(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
classDescription: clh_description,
|
||||
|
|
Loading…
Reference in New Issue
Block a user