Skip to content

Commit

Permalink
add Edit menu in osx. because i am such a NICE GUY. actually because …
Browse files Browse the repository at this point in the history
…copy/paste keyboard shortcuts seems to be broken. turtl/tracker#139
  • Loading branch information
orthecreedence committed Aug 27, 2018
1 parent 9b0e1ba commit 00ae955
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use strict";
const electron = require('electron');
const app = electron.app;
const Menu = electron.Menu;
const BrowserWindow = electron.BrowserWindow;
const url = require('url');
const path = require('path');
Expand Down Expand Up @@ -48,6 +49,28 @@ function create_main_window() {
});
if(process.platform != 'darwin') {
main_window.setMenu(null);
} else {
var template = [
{
label: "Application",
submenu: [
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}
]
},
{
label: "Edit",
submenu: [
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
{ type: "separator" },
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
]
}
];
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
}
main_window.loadURL(url.format({
pathname: path.join(__dirname, 'build', 'index.html'),
Expand Down

0 comments on commit 00ae955

Please sign in to comment.