mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-27 00:50:49 +03:00
lint
This commit is contained in:
parent
04d4474648
commit
3f8b933d05
@ -1,4 +1,5 @@
|
|||||||
import { app, ipcMain, Menu, Tray, shell } from 'electron'
|
import { app, ipcMain, Menu, Tray, shell } from 'electron'
|
||||||
|
// eslint-disable-next-line no-duplicate-imports
|
||||||
import * as electron from 'electron'
|
import * as electron from 'electron'
|
||||||
import { loadConfig } from './config'
|
import { loadConfig } from './config'
|
||||||
import { Window, WindowOptions } from './window'
|
import { Window, WindowOptions } from './window'
|
||||||
@ -75,7 +76,7 @@ export class Application {
|
|||||||
this.tray = new Tray(`${app.getAppPath()}/assets/tray.png`)
|
this.tray = new Tray(`${app.getAppPath()}/assets/tray.png`)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tray.on('click', () => setTimeout(() => this.focus()));
|
this.tray.on('click', () => setTimeout(() => this.focus()))
|
||||||
|
|
||||||
const contextMenu = Menu.buildFromTemplate([{
|
const contextMenu = Menu.buildFromTemplate([{
|
||||||
label: 'Show',
|
label: 'Show',
|
||||||
@ -186,7 +187,7 @@ export class Application {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
|
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
|
||||||
|
@ -20,25 +20,25 @@ export function parseArgs (argv, cwd) {
|
|||||||
return yargs.option('escape', {
|
return yargs.option('escape', {
|
||||||
alias: 'e',
|
alias: 'e',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
describe: 'Perform shell escaping'
|
describe: 'Perform shell escaping',
|
||||||
}).positional('text', {
|
}).positional('text', {
|
||||||
type: 'string'
|
type: 'string',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.version('version', '', app.getVersion())
|
.version('version', '', app.getVersion())
|
||||||
.option('debug', {
|
.option('debug', {
|
||||||
alias: 'd',
|
alias: 'd',
|
||||||
describe: 'Show DevTools on start',
|
describe: 'Show DevTools on start',
|
||||||
type: 'boolean'
|
type: 'boolean',
|
||||||
})
|
})
|
||||||
.option('hidden', {
|
.option('hidden', {
|
||||||
describe: 'Start minimized',
|
describe: 'Start minimized',
|
||||||
type: 'boolean'
|
type: 'boolean',
|
||||||
})
|
})
|
||||||
.option('version', {
|
.option('version', {
|
||||||
alias: 'v',
|
alias: 'v',
|
||||||
describe: 'Show version and exit',
|
describe: 'Show version and exit',
|
||||||
type: 'boolean'
|
type: 'boolean',
|
||||||
})
|
})
|
||||||
.help('help')
|
.help('help')
|
||||||
.parse(argv.slice(1))
|
.parse(argv.slice(1))
|
||||||
|
@ -59,8 +59,8 @@ app.on('ready', () => {
|
|||||||
label: 'New window',
|
label: 'New window',
|
||||||
click () {
|
click () {
|
||||||
this.app.newWindow()
|
this.app.newWindow()
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]))
|
]))
|
||||||
}
|
}
|
||||||
application.init()
|
application.init()
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
let lru = require('lru-cache')({ max: 256, maxAge: 250 })
|
import createLRU from 'lru-cache'
|
||||||
|
import * as fs from 'fs'
|
||||||
let fs = require('fs')
|
const lru = createLRU({ max: 256, maxAge: 250 })
|
||||||
let origLstat = fs.realpathSync.bind(fs)
|
const origLstat = fs.realpathSync.bind(fs)
|
||||||
|
|
||||||
// NB: The biggest offender of thrashing realpathSync is the node module system
|
// NB: The biggest offender of thrashing realpathSync is the node module system
|
||||||
// itself, which we can't get into via any sane means.
|
// itself, which we can't get into via any sane means.
|
||||||
require('fs').realpathSync = function (p) {
|
require('fs').realpathSync = function (p) {
|
||||||
let r = lru.get(p)
|
let r = lru.get(p)
|
||||||
if (r) return r
|
if (r) {
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
r = origLstat(p)
|
r = origLstat(p)
|
||||||
lru.set(p, r)
|
lru.set(p, r)
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
const { init } = process.type === 'main' ? require('@sentry/electron/dist/main') : require('@sentry/electron/dist/renderer')
|
const { init } = process.type === 'main' ? require('@sentry/electron/dist/main') : require('@sentry/electron/dist/renderer')
|
||||||
import * as isDev from 'electron-is-dev'
|
import * as isDev from 'electron-is-dev'
|
||||||
|
|
||||||
|
|
||||||
const SENTRY_DSN = 'https://4717a0a7ee0b4429bd3a0f06c3d7eec3@sentry.io/181876'
|
const SENTRY_DSN = 'https://4717a0a7ee0b4429bd3a0f06c3d7eec3@sentry.io/181876'
|
||||||
let release
|
let release
|
||||||
try {
|
try {
|
||||||
release = require('electron').app.getVersion()
|
release = require('electron').app.getVersion()
|
||||||
} catch {
|
} catch {
|
||||||
release = require('electron').remote.app.getVersion()
|
release = require('electron').remote.app.getVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDev) {
|
if (!isDev) {
|
||||||
init({
|
init({
|
||||||
dsn: SENTRY_DSN,
|
dsn: SENTRY_DSN,
|
||||||
release,
|
release,
|
||||||
integrations (integrations) {
|
integrations (integrations) {
|
||||||
return integrations.filter(integration => integration.name !== 'Breadcrumbs')
|
return integrations.filter(integration => integration.name !== 'Breadcrumbs')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -56,14 +56,14 @@ export class Window {
|
|||||||
|
|
||||||
if (this.windowBounds) {
|
if (this.windowBounds) {
|
||||||
Object.assign(bwOptions, this.windowBounds)
|
Object.assign(bwOptions, this.windowBounds)
|
||||||
const closestDisplay = screen.getDisplayNearestPoint( {x: this.windowBounds.x, y: this.windowBounds.y} )
|
const closestDisplay = screen.getDisplayNearestPoint( { x: this.windowBounds.x, y: this.windowBounds.y } )
|
||||||
|
|
||||||
const [left1, top1, right1, bottom1] = [this.windowBounds.x, this.windowBounds.y, this.windowBounds.x + this.windowBounds.width, this.windowBounds.y + this.windowBounds.height];
|
const [left1, top1, right1, bottom1] = [this.windowBounds.x, this.windowBounds.y, this.windowBounds.x + this.windowBounds.width, this.windowBounds.y + this.windowBounds.height]
|
||||||
const [left2, top2, right2, bottom2] = [closestDisplay.bounds.x, closestDisplay.bounds.y, closestDisplay.bounds.x + closestDisplay.bounds.width, closestDisplay.bounds.y + closestDisplay.bounds.height];
|
const [left2, top2, right2, bottom2] = [closestDisplay.bounds.x, closestDisplay.bounds.y, closestDisplay.bounds.x + closestDisplay.bounds.width, closestDisplay.bounds.y + closestDisplay.bounds.height]
|
||||||
|
|
||||||
if ((left2 > right1 || right2 < left1 || top2 > bottom1 || bottom2 < top1) && !maximized) {
|
if ((left2 > right1 || right2 < left1 || top2 > bottom1 || bottom2 < top1) && !maximized) {
|
||||||
bwOptions.x = closestDisplay.bounds.width / 2 - bwOptions.width / 2;
|
bwOptions.x = closestDisplay.bounds.width / 2 - bwOptions.width / 2
|
||||||
bwOptions.y = closestDisplay.bounds.height / 2 - bwOptions.height / 2;
|
bwOptions.y = closestDisplay.bounds.height / 2 - bwOptions.height / 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ export class Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isDestroyed () {
|
isDestroyed () {
|
||||||
return !this.window || this.window.isDestroyed();
|
return !this.window || this.window.isDestroyed()
|
||||||
}
|
}
|
||||||
|
|
||||||
private setupWindowManagement () {
|
private setupWindowManagement () {
|
||||||
|
Loading…
Reference in New Issue
Block a user