diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 60567acf32..a3cf14c606 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -19,6 +19,10 @@ "message": "&Help", "description": "The label that is used for the Help menu in the program main menu. The '&' indicates that the following letter will be used as the keyboard 'shortcut letter' for accessing the menu with the Alt- combination." }, + "mainMenuSettings": { + "message": "Preferences…", + "description": "The label that is used for the Preferences menu in the program main menu. This should be consistent with the standard naming for ‘Preferences’ on the operating system." + }, "menuSetupWithImport": { "message": "Set up with import", "description": "When the application is not yet set up, menu option to start up the import sequence" diff --git a/app/menu.js b/app/menu.js index 4251546385..272c07bbb6 100644 --- a/app/menu.js +++ b/app/menu.js @@ -18,11 +18,20 @@ exports.createTemplate = (options, messages) => { setupWithImport, showAbout, showDebugLog, + showSettings, } = options; const template = [{ label: messages.mainMenuFile.message, submenu: [ + { + label: messages.mainMenuSettings.message, + accelerator: 'CommandOrControl+,', + click: showSettings, + }, + { + type: 'separator', + }, { role: 'quit', }, @@ -218,6 +227,14 @@ function updateForMac(template, messages, options) { { type: 'separator', }, + { + label: messages.mainMenuSettings.message, + accelerator: 'CommandOrControl+,', + click: showSettings, + }, + { + type: 'separator', + }, { role: 'hide', }, diff --git a/js/background.js b/js/background.js index 0788764ac9..0c6e733f5e 100644 --- a/js/background.js +++ b/js/background.js @@ -170,6 +170,16 @@ Whisper.events.on('showDebugLog', function() { appView.openDebugLog(); }); + Whisper.events.on('showSettings', () => { + if (!appView || !appView.inboxView) { + console.log( + 'background: Event: \'showSettings\':' + + ' Expected `appView.inboxView` to exist.' + ); + return; + } + appView.inboxView.showSettings(); + }); Whisper.events.on('unauthorized', function() { appView.inboxView.networkStatusView.update(); }); diff --git a/main.js b/main.js index 295bf0ea31..766749abd5 100644 --- a/main.js +++ b/main.js @@ -324,6 +324,14 @@ function showDebugLog() { } } +function showSettings() { + if (!mainWindow) { + return; + } + + mainWindow.webContents.send('show-settings'); +} + function openReleaseNotes() { shell.openExternal(`https://github.com/signalapp/Signal-Desktop/releases/tag/v${app.getVersion()}`); } @@ -449,6 +457,7 @@ function setupMenu(options) { setupWithImport, setupAsNewDevice, setupAsStandalone, + showSettings, }); const template = createTemplate(menuOptions, locale.messages); const menu = Menu.buildFromTemplate(template); diff --git a/preload.js b/preload.js index 93a67c9ce4..742082fb08 100644 --- a/preload.js +++ b/preload.js @@ -54,6 +54,10 @@ Whisper.events.trigger('setupAsStandalone'); }); + ipc.on('show-settings', function() { + Whisper.events.trigger('showSettings'); + }); + window.addSetupMenuItems = function() { ipc.send('add-setup-menu-items'); } diff --git a/test/app/fixtures/menu-mac-os.json b/test/app/fixtures/menu-mac-os.json index 19ee683987..cbf3234e43 100644 --- a/test/app/fixtures/menu-mac-os.json +++ b/test/app/fixtures/menu-mac-os.json @@ -8,6 +8,14 @@ { "type": "separator" }, + { + "label": "Preferences…", + "accelerator": "CommandOrControl+,", + "click": null + }, + { + "type": "separator" + }, { "role": "hide" }, diff --git a/test/app/fixtures/menu-windows-linux.json b/test/app/fixtures/menu-windows-linux.json index a599403867..659bdf1cdf 100644 --- a/test/app/fixtures/menu-windows-linux.json +++ b/test/app/fixtures/menu-windows-linux.json @@ -2,6 +2,14 @@ { "label": "&File", "submenu": [ + { + "label": "Preferences…", + "accelerator": "CommandOrControl+,", + "click": null + }, + { + "type": "separator" + }, { "role": "quit" }