fx102: Update quit keybindings

- Add 'x' accesskey for "Exit" on Windows
- Show "Quit" instead of "Exit" on Linux
- Don't show Ctrl-Q for shortcut key on Windows

But Ctrl-Q still works on Windows when it shouldn't because of the Mac
keybinding, which still gets registered even if disabled
programmatically in platformKeys.js.

fx102 follow-up to #3010
This commit is contained in:
Dan Stillman 2023-03-09 01:22:57 -05:00
parent b4d534c02d
commit c675150305
2 changed files with 20 additions and 5 deletions

View file

@ -5,8 +5,9 @@ window.addEventListener('DOMContentLoaded', () => {
let redoKey = document.getElementById('key_redo');
let fileQuitSeparator = document.getElementById('menu_NonMacFileQuitSeparator');
let fileQuitItem = document.getElementById('menu_NonMacFileQuitItem');
let fileQuitSeparator = document.getElementById('menu_fileQuitSeparatorNonMac');
let fileQuitItemWin = document.getElementById('menu_fileQuitItemWin');
let fileQuitItemUnix = document.getElementById('menu_fileQuitItemUnix');
let editPreferencesSeparator = document.getElementById('menu_EditPreferencesSeparator');
let editPreferencesItem = document.getElementById('menu_EditPreferencesItem');
@ -33,7 +34,8 @@ window.addEventListener('DOMContentLoaded', () => {
if (isMac) {
// Set behavior on macOS only
if (fileQuitSeparator) fileQuitSeparator.hidden = true;
if (fileQuitItem) fileQuitItem.hidden = true;
if (fileQuitItemWin) fileQuitItemWin.hidden = true;
if (fileQuitItemUnix) fileQuitItemUnix.hidden = true;
if (editPreferencesSeparator) editPreferencesSeparator.hidden = true;
if (editPreferencesItem) editPreferencesItem.hidden = true;
}
@ -41,6 +43,15 @@ window.addEventListener('DOMContentLoaded', () => {
// Set behavior on all non-macOS platforms
if (applicationMenu) applicationMenu.hidden = true;
if (windowMenu) windowMenu.hidden = true;
// DEBUG: This doesn't disable Ctrl-Q, which shouldn't be active on Windows
// (fx102 follow-up to https://github.com/zotero/zotero/pull/3010)
if (macKeyset) macKeyset.disabled = true;
if (isWin) {
fileQuitItemUnix.hidden = true;
}
else {
fileQuitItemWin.hidden = true;
}
}
});

View file

@ -220,9 +220,13 @@
command="cmd_zotero_importFromClipboard" key="key_importFromClipboard"/>
<menuitem id="menu_exportLibrary" class="menu-type-library" label="&zotero.toolbar.export.label;"
command="cmd_zotero_exportLibrary"/>
<menuseparator id="menu_NonMacFileQuitSeparator"/>
<menuitem id="menu_NonMacFileQuitItem"
<menuseparator id="menu_fileQuitSeparatorNonMac"/>
<menuitem id="menu_fileQuitItemWin"
label="&quitApplicationCmdWin.label;"
accesskey="&quitApplicationCmdWin.accesskey;"
command="cmd_quitApplication"/>
<menuitem id="menu_fileQuitItemUnix"
label="&quitApplicationCmd.label;"
key="key_quitApplication"
command="cmd_quitApplication"/>
</menupopup>