Skip to content

Commit

Permalink
Fixes for paste, select all, etc shortcuts. (Menu items completely re…
Browse files Browse the repository at this point in the history
…written.)
  • Loading branch information
bcalik committed Apr 6, 2016
1 parent c42d449 commit 612a82d
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 60 deletions.
163 changes: 104 additions & 59 deletions app/menu.js
Original file line number Diff line number Diff line change
@@ -1,77 +1,52 @@
(function(scope) {
"use strict";

module.exports = [
{
label: 'WhatsApp Desktop',
submenu: [
{
label: 'About WhatsApp',
role: 'orderFrontStandardAboutPanel:'
},
{
label: 'Settings',
accelerator: 'CmdOrCtrl+',
click: function () {
global.settings.init();
}
},
{ type: 'separator' },
{
label: 'Hide WhatsApp',
accelerator: 'CmdOrCtrl+H',
selector: 'hide:'
},
{
label: 'Hide Others',
accelerator: 'CmdOrCtrl+Shift+H',
role: 'hideOtherApplications:'
},
{
label: 'Show All',
role: 'unhideAllApplications:'
},
{ type: 'separator' },
{
label: 'Quit',
accelerator: 'CmdOrCtrl+Q',
selector: 'terminate:'
}
]
},
var template = [
{
label: 'Edit',
submenu: [
{
label: 'Undo',
accelerator: 'CmdOrCtrl+Z',
role: 'undo:'
role: 'undo'
},
{
label: 'Redo',
accelerator: 'Shift+CmdOrCtrl+Z',
role: 'redo:'
role: 'redo'
},
{
type: 'separator'
},
{ type: 'separator' },
{
label: 'Cut',
accelerator: 'CmdOrCtrl+X',
role: 'cut:'
role: 'cut'
},
{
label: 'Copy',
accelerator: 'CmdOrCtrl+C',
role: 'copy:'
role: 'copy'
},
{
label: 'Paste',
accelerator: 'CmdOrCtrl+V',
role: 'paste:'
role: 'paste'
},
{
label: 'Select All',
accelerator: 'CmdOrCtrl+A',
role: 'selectAll:'
role: 'selectall'
},
{
type: 'separator'
},
{
label: 'Settings',
accelerator: 'CmdOrCtrl+',
click: function () {
global.settings.init();
}
}
]
},
Expand All @@ -81,35 +56,105 @@
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click: function() { global.whatsApp.window.reload(); }
click: function(item, focusedWindow) {
if (focusedWindow)
focusedWindow.reload();
}
},
{
label: 'Toggle DevTools',
accelerator: 'Alt+CmdOrCtrl+I',
click: function() { global.whatsApp.window.toggleDevTools(); }
}
label: 'Toggle Full Screen',
accelerator: (function() {
if (process.platform == 'darwin')
return 'Ctrl+Command+F';
else
return 'F11';
})(),
click: function(item, focusedWindow) {
if (focusedWindow)
focusedWindow.setFullScreen(!focusedWindow.isFullScreen());
}
},
{
label: 'Toggle Developer Tools',
accelerator: (function() {
if (process.platform == 'darwin')
return 'Alt+Command+I';
else
return 'Ctrl+Shift+I';
})(),
click: function(item, focusedWindow) {
if (focusedWindow)
focusedWindow.toggleDevTools();
}
},
]
},
{
label: 'Window',
role: 'window',
submenu: [
{
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
selector: 'performMiniaturize:'
role: 'minimize'
},
{
label: 'Close',
accelerator: 'CmdOrCtrl+W',
selector: 'performClose:'

},
{ type: 'separator' },
{
label: 'Bring All to Front',
role: 'arrangeInFront:'
role: 'close'
}
]
}
];
})(this);

if (process.platform == 'darwin') {
var name = 'WhatsApp Desktop';
template.unshift({
label: name,
submenu: [
{
label: 'About ' + name,
role: 'about'
},
{
type: 'separator'
},
{
label: 'Hide ' + name,
accelerator: 'Command+H',
role: 'hide'
},
{
label: 'Hide Others',
accelerator: 'Command+Alt+H',
role: 'hideothers'
},
{
label: 'Show All',
role: 'unhide'
},
{
type: 'separator'
},
{
label: 'Quit',
accelerator: 'Command+Q',
click: () => { require('app').quit() }
},
]
});
// Window menu.
template[3].submenu.push(
{
type: 'separator'
},
{
label: 'Bring All to Front',
role: 'front'
}
);
}

module.exports = template;

})(this);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whatsapp-desktop",
"version": "0.3.1",
"version": "0.3.2",
"repository": "https://github.com/bcalik/Whatsapp-Desktop.git",
"description": "Unofficial WhatsApp Desktop Client. Build with Electron.",
"main": "main.js",
Expand Down

0 comments on commit 612a82d

Please sign in to comment.