started separating terminus-electron and terminus-web

This commit is contained in:
Eugene Pankov
2021-05-24 17:48:12 +02:00
parent c19e131d8c
commit 012986dc7e
94 changed files with 1899 additions and 972 deletions

View File

@@ -7,6 +7,12 @@ import { Window, WindowOptions } from './window'
import { pluginManager } from './pluginManager'
import { PTYManager } from './pty'
/* eslint-disable block-scoped-var */
try {
var wnr = require('windows-native-registry') // eslint-disable-line @typescript-eslint/no-var-requires, no-var
} catch (_) { }
export class Application {
private tray?: Tray
private ptyManager = new PTYManager()
@@ -14,6 +20,7 @@ export class Application {
constructor () {
remote.initialize()
this.useBuiltinGraphics()
this.ptyManager.init(this)
ipcMain.on('app:config-change', (_event, config) => {
@@ -161,6 +168,16 @@ export class Application {
this.windows[this.windows.length - 1].passCliArguments(argv, cwd, true)
}
private useBuiltinGraphics (): void {
if (process.platform === 'win32') {
const keyPath = 'SOFTWARE\\Microsoft\\DirectX\\UserGpuPreferences'
const valueName = app.getPath('exe')
if (!wnr.getRegistryValue(wnr.HK.CU, keyPath, valueName)) {
wnr.setRegistryValue(wnr.HK.CU, keyPath, valueName, wnr.REG.SZ, 'GpuPreference=1;')
}
}
}
private setupMenu () {
const template: MenuItemConstructorOptions[] = [
{

View File

@@ -122,7 +122,7 @@ export class Window {
}
})
this.window.loadURL(`file://${app.getAppPath()}/dist/index.html?${this.window.id}`, { extraHeaders: 'pragma: no-cache\n' })
this.window.loadURL(`file://${app.getAppPath()}/dist/index.html`, { extraHeaders: 'pragma: no-cache\n' })
this.window.webContents.setVisualZoomLevelLimits(1, 1)
this.window.webContents.setZoomFactor(1)
@@ -297,6 +297,8 @@ export class Window {
this.window.webContents.send('start', {
config: this.configStore,
executable: app.getPath('exe'),
windowID: this.window.id,
isFirstWindow: this.window.id === 1,
})
})