feat: added macos basic shortcusts and menu

This commit is contained in:
Giulio Ganci 2021-10-24 13:02:37 +02:00
parent a35566f273
commit 430490ad93
3 changed files with 34 additions and 2 deletions

View File

@ -118,7 +118,25 @@ function createAppMenu () {
if (isMacOS) {
menu = Menu.buildFromTemplate([
{
role: 'appMenu'
label: app.name,
submenu: [
{ role: 'about' },
{ type: 'separator' },
{
label: 'Check for Updates...',
click: (_menuItem, win) => win.webContents.send('open-updates-preferences')
},
{
label: 'Preferences',
click: (_menuItem, win) => win.webContents.send('toggle-preferences'),
accelerator: 'CmdOrCtrl+,'
},
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideOthers' },
{ type: 'separator' },
{ role: 'quit' }
]
},
{
role: 'editMenu'

View File

@ -13,6 +13,7 @@ import notifications from './modules/notifications.store';
import ipcUpdates from './plugins/ipcUpdates';
import ipcExceptions from './plugins/ipcExceptions';
import ipcShortcuts from './plugins/ipcShortcuts';
Vue.use(Vuex);
@ -29,6 +30,7 @@ export default new Vuex.Store({
},
plugins: [
ipcUpdates,
ipcExceptions
ipcExceptions,
ipcShortcuts
]
});

View File

@ -0,0 +1,12 @@
import { ipcRenderer } from 'electron';
export default store => {
ipcRenderer.on('toggle-preferences', (event, error) => {
store.dispatch('application/showSettingModal', 'general');
});
ipcRenderer.on('open-updates-preferences', (event, error) => {
store.dispatch('application/showSettingModal', 'update');
ipcRenderer.send('check-for-updates');
});
};