Skip to content

Commit

Permalink
Add linux keymaps
Browse files Browse the repository at this point in the history
  • Loading branch information
benogle committed Aug 20, 2015
1 parent 12aa4a0 commit 33546fd
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/browser/application-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ApplicationWindow {
hash: encodeURIComponent(JSON.stringify(args))
});
this.window.loadUrl(indexUrl);
this.menu = Menu.buildFromTemplate(require('./menu-darwin')(app, this.window));
this.menu = Menu.buildFromTemplate(require('./menu-'+process.platform)(app, this.window));
Menu.setApplicationMenu(this.menu);
}

Expand Down
122 changes: 122 additions & 0 deletions src/browser/menu-linux.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
module.exports = function(app, window) {
return [
{
label: 'App',
submenu: [
{
label: 'About',
selector: 'orderFrontStandardAboutPanel:'
},
{
type: 'separator'
},
{
label: 'Hide',
accelerator: 'Control+H',
selector: 'hide:'
},
{
label: 'Hide Others',
accelerator: 'Control+Shift+H',
selector: 'hideOtherApplications:'
},
{
label: 'Show All',
selector: 'unhideAllApplications:'
},
{
type: 'separator'
},
{
label: 'Quit',
accelerator: 'Control+Q',
click: () => app.quit()
}
]
},
{
label: 'File',
submenu: [
{
label: 'New File',
accelerator: 'Control+n',
click: () => global.application.openNewWindow()
},
{
label: 'Open…',
accelerator: 'Control+o',
click: () => global.application.openFileDialog()
},
{
label: 'Save',
accelerator: 'Control+s',
click: () => global.application.saveActiveFile()
},
{
label: 'Save As…',
accelerator: 'Control+Shift+s',
click: () => global.application.saveActiveFileAs()
},
{
type: 'separator'
},
{
label: 'Close Window',
accelerator: 'Control+W',
click: () => window.close()
}
]
},
{
label: 'View',
submenu: [
{
label: 'Reload',
accelerator: 'Control+R',
click: () => window.restart()
},
{
label: 'Toggle Full Screen',
accelerator: 'Control+Shift+F',
click: () => window.setFullScreen(!window.isFullScreen())
},
{
label: 'Toggle Developer Tools',
accelerator: 'Alt+Control+I',
click: () => window.toggleDevTools()
}
]
},
{
label: 'Window',
submenu: [
{
label: 'Minimize',
accelerator: 'Control+M',
selector: 'performMiniaturize:'
},
{
label: 'Close',
accelerator: 'Control+W',
selector: 'performClose:'
},
{
type: 'separator'
},
{
label: 'Bring All to Front',
selector: 'arrangeInFront:'
}
]
},
{
label: 'Help',
submenu: [
{
label: 'Repository',
click: () => require('shell').openExternal('http://github.com/benogle/electron-sample')
}
]
}
];
};

0 comments on commit 33546fd

Please sign in to comment.