mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Merge pull request #200 from aaronraimist/macos-preferences
This commit is contained in:
commit
330e230f2c
@ -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 = [
|
||||||
@ -77,11 +79,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'),
|
||||||
@ -121,7 +123,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',
|
||||||
@ -129,7 +131,13 @@ function buildMenuTemplate() {
|
|||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
role: 'about',
|
role: 'about',
|
||||||
label: _t('About'),
|
label: _t('About') + ' ' + app.name,
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: _t('Preferences') + '…',
|
||||||
|
accelerator: 'Command+,', // Mac-only accelerator
|
||||||
|
click() { global.mainWindow.webContents.send('preferences'); },
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user