mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Put Preferences menu item in correct location on macOS
Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
parent
767445e6f6
commit
5055ad0aec
@ -17,6 +17,8 @@ limitations under the License.
|
|||||||
const { app, shell, Menu } = require('electron');
|
const { app, shell, Menu } = require('electron');
|
||||||
const { _t } = require('./language-helper');
|
const { _t } = require('./language-helper');
|
||||||
|
|
||||||
|
const isMac = process.platform === 'darwin';
|
||||||
|
|
||||||
function buildMenuTemplate() {
|
function buildMenuTemplate() {
|
||||||
// Menu template from http://electron.atom.io/docs/api/menu/, edited
|
// Menu template from http://electron.atom.io/docs/api/menu/, edited
|
||||||
const template = [
|
const template = [
|
||||||
@ -78,11 +80,11 @@ function buildMenuTemplate() {
|
|||||||
label: _t('Zoom Out'),
|
label: _t('Zoom Out'),
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
// in macOS the Preferences menu item goes in the first menu
|
||||||
|
...(!isMac ? [{
|
||||||
label: _t('Preferences'),
|
label: _t('Preferences'),
|
||||||
accelerator: 'Command+,', // Mac-only accelerator
|
|
||||||
click() { global.mainWindow.webContents.send('preferences'); },
|
click() { global.mainWindow.webContents.send('preferences'); },
|
||||||
},
|
}] : []),
|
||||||
{
|
{
|
||||||
role: 'togglefullscreen',
|
role: 'togglefullscreen',
|
||||||
label: _t('Toggle Full Screen'),
|
label: _t('Toggle Full Screen'),
|
||||||
@ -122,7 +124,7 @@ function buildMenuTemplate() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// macOS has specific menu conventions...
|
// macOS has specific menu conventions...
|
||||||
if (process.platform === 'darwin') {
|
if (isMac) {
|
||||||
template.unshift({
|
template.unshift({
|
||||||
// first macOS menu is the name of the app
|
// first macOS menu is the name of the app
|
||||||
role: 'appMenu',
|
role: 'appMenu',
|
||||||
@ -133,6 +135,12 @@ function buildMenuTemplate() {
|
|||||||
label: _t('About'),
|
label: _t('About'),
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: _t('Preferences'),
|
||||||
|
accelerator: 'Command+,', // Mac-only accelerator
|
||||||
|
click() { global.mainWindow.webContents.send('preferences'); },
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
role: 'services',
|
role: 'services',
|
||||||
label: _t('Services'),
|
label: _t('Services'),
|
||||||
|
Loading…
Reference in New Issue
Block a user