KawAnime/assets/menu.js

182 lines
2.9 KiB
JavaScript
Raw Normal View History

2017-04-26 17:58:21 +00:00
/**
* Created by Kylart on 18/03/2017.
*/
const electron = require('electron')
2017-05-08 13:18:10 +00:00
const app = electron.app
2017-04-26 17:58:21 +00:00
const template = () => {
let menu = [
{
label: 'Edit',
submenu: [
{
role: 'copy'
},
{
role: 'paste'
},
{
role: 'delete'
},
{
type: 'separator'
},
{
label: 'Preferences',
accelerator: 'Ctrl+,'
}
]
},
{
label: 'View',
submenu: [
{
role: 'reload'
},
{
role: 'forcereload'
},
{
type: 'separator'
},
{
role: 'resetzoom'
},
{
role: 'zoomin'
},
{
role: 'zoomout'
},
{
type: 'separator'
},
{
role: 'togglefullscreen'
},
{
type: 'separator'
},
{
label: 'Developpers',
submenu: [
{
role: 'toggledevtools'
}
]
}
]
},
{
role: 'window',
submenu: [
{
role: 'minimize'
},
{
role: 'close'
}
]
},
{
role: 'help',
submenu: [
{
label: 'Learn More',
click () { require('electron').shell.openExternal('https://github.com/Kylart/KawAnime') }
}
]
}
]
2017-05-08 13:38:26 +00:00
if (process.platform === 'darwin') {
2017-04-26 17:58:21 +00:00
menu.unshift({
label: app.getName(),
submenu: [
{
role: 'about'
},
{
type: 'separator'
},
{
label: 'Preferences',
accelerator: 'Cmd+,'
},
{
type: 'separator'
},
{
role: 'services',
submenu: []
},
{
type: 'separator'
},
{
role: 'hide'
},
{
role: 'hideothers'
},
{
role: 'unhide'
},
{
type: 'separator'
},
{
role: 'quit'
}
]
})
// Edit menu.
menu[1].submenu.pop() // Removing preferences from this part.
menu[1].submenu.push(
2017-05-08 13:38:26 +00:00
{
type: 'separator'
},
{
label: 'Speech',
submenu: [
{
role: 'startspeaking'
},
{
role: 'stopspeaking'
}
]
}
2017-04-26 17:58:21 +00:00
)
// Window menu.
menu[3].submenu = [
{
label: 'Close',
accelerator: 'CmdOrCtrl+W',
role: 'close'
},
{
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
role: 'minimize'
},
{
label: 'Zoom',
role: 'zoom'
},
{
type: 'separator'
},
{
label: 'Bring All to Front',
role: 'front'
}
]
}
return menu
}
2017-05-08 13:18:10 +00:00
exports.menu = template()