kiki/coffee/mainmenu.coffee
2016-10-10 18:28:35 +02:00

86 lines
3.1 KiB
CoffeeScript

# 00 00 0000000 000 000 000 00 00 00000000 000 000 000 000
# 000 000 000 000 000 0000 000 000 000 000 0000 000 000 000
# 000000000 000000000 000 000 0 000 000000000 0000000 000 0 000 000 000
# 000 0 000 000 000 000 000 0000 000 0 000 000 000 0000 000 000
# 000 000 000 000 000 000 000 000 000 00000000 000 000 0000000
{
unresolve
} = require './tools/tools'
log = require './tools/log'
pkg = require '../package.json'
fs = require 'fs'
path = require 'path'
Menu = require('electron').Menu
class MainMenu
@init: (main) ->
fileLabel = (f) ->
return path.basename(f) + ' - ' + unresolve path.dirname(f) if f?
"untitled"
Menu.setApplicationMenu Menu.buildFromTemplate [
label: pkg.name
submenu: [
label: "About #{pkg.productName}"
click: main.showAbout
,
type: 'separator'
,
label: "Hide #{pkg.productName}"
accelerator: 'Command+H'
click: main.hideWindows
,
label: 'Hide Others'
accelerator: 'Command+Alt+H'
role: 'hideothers'
,
type: 'separator'
,
label: 'Quit'
accelerator: 'Command+Q'
click: main.quit
]
,
# 000 000 000 000 000 0000000 0000000 000 000
# 000 0 000 000 0000 000 000 000 000 000 000 0 000
# 000000000 000 000 0 000 000 000 000 000 000000000
# 000 000 000 000 0000 000 000 000 000 000 000
# 00 00 000 000 000 0000000 0000000 00 00
label: 'Window'
submenu: [
label: 'Minimize'
accelerator: 'Alt+Cmd+M'
click: (i,win) -> win?.minimize()
,
label: 'Maximize'
accelerator: 'Cmd+Shift+m'
click: (i,win) -> main.toggleMaximize win
,
type: 'separator'
,
label: 'Reload Window'
accelerator: 'Ctrl+Alt+Cmd+L'
click: (i,win) -> main.reloadWin win
,
label: 'Toggle FullScreen'
accelerator: 'Ctrl+Command+Alt+F'
click: (i,win) -> win?.setFullScreen !win.isFullScreen()
]
,
# 000 000 00000000 000 00000000
# 000 000 000 000 000 000
# 000000000 0000000 000 00000000
# 000 000 000 000 000
# 000 000 00000000 0000000 000
label: 'Help'
role: 'help'
submenu: []
]
module.exports = MainMenu