set terminus to use built-in graphics by default - fixes #657

This commit is contained in:
Eugene Pankov 2021-02-07 12:49:22 +01:00
parent e2b99d71ad
commit 7583d92747
2 changed files with 16 additions and 0 deletions

View file

@ -142,6 +142,8 @@ export class AppRootComponent {
this.touchbar.update()
this.hostApp.useBuiltinGraphics()
config.changed$.subscribe(() => this.updateVibrancy())
this.updateVibrancy()

View file

@ -8,6 +8,10 @@ import { ElectronService } from './electron.service'
import { Logger, LogService } from './log.service'
import { isWindowsBuild, WIN_BUILD_FLUENT_BG_SUPPORTED } from '../utils'
try {
var wnr = require('windows-native-registry') // eslint-disable-line @typescript-eslint/no-var-requires, no-var
} catch (_) { }
export enum Platform {
Linux = 'Linux',
macOS = 'macOS',
@ -283,6 +287,16 @@ export class HostAppService {
this.electron.ipcRenderer.send('app:register-global-hotkey', specs)
}
useBuiltinGraphics () {
const keyPath = 'SOFTWARE\\Microsoft\\DirectX\\UserGpuPreferences'
const valueName = this.electron.app.getPath('exe')
if (this.platform === Platform.Windows) {
if (!wnr.getRegistryValue(wnr.HK.CU, keyPath, valueName)) {
wnr.setRegistryValue(wnr.HK.CU, keyPath, valueName, wnr.REG.SZ, 'GpuPreference=1;')
}
}
}
relaunch (): void {
if (this.isPortable) {
this.electron.app.relaunch({ execPath: process.env.PORTABLE_EXECUTABLE_FILE })