Don't close Zotero on macOS when window is closed
Keep the application open with limited menus, including a Window -> Zotero option bound to (Cmd-0) that can be used to reopen the main window. This allows Zotero to use almost no CPU (instead of a few percentage points when the window is open, even when hidden with Cmd-H, though it'd be nice to fix that) and still allow saves from the connector. There might be some things that aren't being destroyed properly when the window is closed or other bugginess, but it seems to work pretty well.
This commit is contained in:
parent
a8ba2fac33
commit
5123c21e0d
|
@ -37,24 +37,67 @@
|
|||
]>
|
||||
|
||||
<window id="main-window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script>
|
||||
function openMainWindow() {
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
var chromeURI = prefService.getCharPref('toolkit.defaultChromeURI');
|
||||
var flags = prefService.getCharPref("toolkit.defaultChromeFeatures", "chrome,dialog=no,all");
|
||||
|
||||
var ww = Components.classes['@mozilla.org/embedcomp/window-watcher;1']
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
ww.openWindow(null, chromeURI, '_blank', flags, null);
|
||||
}
|
||||
|
||||
function openAbout() {
|
||||
var ww = Components.classes['@mozilla.org/embedcomp/window-watcher;1']
|
||||
.getService(Components.interfaces.nsIWindowWatcher);
|
||||
ww.openWindow(null, 'chrome://zotero/content/about.xul', 'about', 'chrome,dialog=yes', null);
|
||||
}
|
||||
</script>
|
||||
<commandset id="mainCommandSet">
|
||||
<!--FILE-->
|
||||
<command id="cmd_quitApplication" oncommand="goQuitApplication();"/>
|
||||
<command id="cmd_close" disabled="true"/>
|
||||
<command id="minimizeWindow" disabled="true"/>
|
||||
<command id="zoomWindow" disabled="true"/>
|
||||
<command id="cmd_mainWindow" oncommand="openMainWindow();"/>
|
||||
</commandset>
|
||||
|
||||
<keyset id="mainKeyset">
|
||||
<key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
|
||||
<key id="key_mainWindow" key="0" command="cmd_mainWindow" modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<menubar id="main-menubar">
|
||||
<menu id="fileMenu" label="&fileMenu.label;" accesskey="&fileMenu.accesskey;">
|
||||
<menupopup id="menu_FilePopup">
|
||||
<menuitem id="aboutName"
|
||||
accesskey="&aboutProduct.accesskey;"
|
||||
label="&aboutProduct.label;"
|
||||
oncommand="Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow('navigator:browser').ZoteroPane.openAboutDialog();"/>
|
||||
</menupopup>
|
||||
<!-- This gets moved to the Application menu automatically -->
|
||||
<menuitem id="aboutName"
|
||||
accesskey="&aboutProduct.accesskey;"
|
||||
label="&aboutProduct.label;"
|
||||
oncommand="openAbout()"/>
|
||||
|
||||
<!-- Disabled Close line in File menu, just to show something -->
|
||||
<menuitem id="menu_close"
|
||||
label="&closeCmd.label;"
|
||||
key="key_close"
|
||||
command="cmd_close"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="windowMenu" onpopupshowing="">
|
||||
<menupopup>
|
||||
<menuitem command="minimizeWindow" key="key_minimizeWindow"/>
|
||||
<menuitem command="zoomWindow"/>
|
||||
<menuseparator/>
|
||||
<menuitem command="cmd_mainWindow" label="Zotero" key="key_mainWindow"/>
|
||||
<!--
|
||||
Prevent error from macWindowMenuDidShow(), which is called from a built-in
|
||||
nWindowMenuShowing(), when opening menu
|
||||
-->
|
||||
<menuseparator id="sep-window-list" hidden="true"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menubar>
|
||||
</window>
|
||||
|
|
|
@ -225,7 +225,6 @@ const ZoteroStandalone = new function() {
|
|||
*/
|
||||
this.onUnload = function() {
|
||||
ZoteroPane.destroy();
|
||||
goQuitApplication();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user