1
0
mirror of https://github.com/Eugeny/tabby.git synced 2025-08-14 21:31:51 +00:00
Files
.github
app
assets
lib
app.ts
cli.ts
config.ts
index.ts
lru.ts
portable.ts
sentry.ts
window.ts
src
dev-app-update.yml
index.pug
package.json
tsconfig.json
tsconfig.main.json
webpack.config.js
webpack.main.config.js
yarn.lock
build
docs
extras
scripts
snap
terminus-community-color-schemes
terminus-core
terminus-plugin-manager
terminus-settings
terminus-ssh
terminus-terminal
terminus-uac
.all-contributorsrc
.eslintrc.yml
.gitignore
.mergify.yml
.pug-lintrc.js
.travis.yml
CODE_OF_CONDUCT.md
HACKING.md
LICENSE
README.md
appveyor.yml
electron-builder.yml
package.json
tsconfig.json
typedoc.js
webpack.config.js
yarn.lock
tabby/app/lib/index.ts
Eugene Pankov 3f8b933d05 lint
2020-02-05 15:16:31 +03:00

69 lines
1.4 KiB
TypeScript

import './portable'
import './sentry'
import './lru'
import { app, ipcMain, Menu } from 'electron'
import { parseArgs } from './cli'
import { Application } from './app'
import electronDebug = require('electron-debug')
if (!process.env.TERMINUS_PLUGINS) {
process.env.TERMINUS_PLUGINS = ''
}
const application = new Application()
ipcMain.on('app:new-window', () => {
application.newWindow()
})
app.on('activate', () => {
if (!application.hasWindows()) {
application.newWindow()
} else {
application.focus()
}
})
app.on('window-all-closed', () => {
app.quit()
})
process.on('uncaughtException' as any, err => {
console.log(err)
application.broadcast('uncaughtException', err)
})
app.on('second-instance', (_event, argv, cwd) => {
application.send('host:second-instance', parseArgs(argv, cwd), cwd)
})
const argv = parseArgs(process.argv, process.cwd())
if (!app.requestSingleInstanceLock()) {
app.quit()
app.exit(0)
}
if (argv.d) {
electronDebug({
isEnabled: true,
showDevTools: true,
devToolsMode: 'undocked',
})
}
app.on('ready', () => {
if (process.platform === 'darwin') {
app.dock.setMenu(Menu.buildFromTemplate([
{
label: 'New window',
click () {
this.app.newWindow()
},
},
]))
}
application.init()
application.newWindow({ hidden: argv.hidden })
})