From bbb513d420e6f6616d642c75538f609950acece9 Mon Sep 17 00:00:00 2001 From: David Kramer Date: Sun, 22 Apr 2018 12:56:10 -0700 Subject: [PATCH] Fix #364 - Add --disable-gpu flag to disable hardware acceleration (PR #584) --- app/src/main.js | 4 ++++ docs/api.md | 8 ++++++++ src/build/buildApp.js | 1 + src/cli.js | 1 + src/options/optionsMain.js | 1 + 5 files changed, 15 insertions(+) diff --git a/app/src/main.js b/app/src/main.js index 33d5b83..9edeff1 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -38,6 +38,10 @@ if (appArgs.ignoreCertificate) { app.commandLine.appendSwitch('ignore-certificate-errors'); } +if (appArgs.disableGpu) { + app.disableHardwareAcceleration(); +} + if (appArgs.ignoreGpuBlacklist) { app.commandLine.appendSwitch('ignore-gpu-blacklist'); } diff --git a/docs/api.md b/docs/api.md index 6338da6..b69d5c1 100644 --- a/docs/api.md +++ b/docs/api.md @@ -48,6 +48,7 @@ - [[basic-auth-username]](#basic-auth-username) - [[basic-auth-password]](#basic-auth-username) - [[always-on-top]](#always-on-top) + - [[disable-gpu]](#disable-gpu) - [Programmatic API](#programmatic-api) ## Command Line @@ -298,6 +299,13 @@ If this flag is passed, it will not override the user agent. ``` Forces the packaged app to ignore certificate errors. +#### [disable-gpu] + +``` +--disable-gpu +``` +Disable hardware acceleration for the packaged application. + #### [ignore-gpu-blacklist] ``` diff --git a/src/build/buildApp.js b/src/build/buildApp.js index 9c804bc..a06bd9a 100644 --- a/src/build/buildApp.js +++ b/src/build/buildApp.js @@ -29,6 +29,7 @@ function selectAppArgs(options) { userAgent: options.userAgent, nativefierVersion: options.nativefierVersion, ignoreCertificate: options.ignoreCertificate, + disableGpu: options.disableGpu, ignoreGpuBlacklist: options.ignoreGpuBlacklist, enableEs3Apis: options.enableEs3Apis, insecure: options.insecure, diff --git a/src/cli.js b/src/cli.js index 9bbeeac..f9ff700 100755 --- a/src/cli.js +++ b/src/cli.js @@ -68,6 +68,7 @@ if (require.main === module) { .option('-u, --user-agent ', 'set the user agent string for the app') .option('--honest', 'prevent the nativefied app from changing the user agent string to masquerade as a regular chrome browser') .option('--ignore-certificate', 'ignore certificate related errors') + .option('--disable-gpu', 'disable hardware acceleration') .option('--ignore-gpu-blacklist', 'allow WebGl apps to work on non supported graphics cards') .option('--enable-es3-apis', 'force activation of WebGl 2.0') .option('--insecure', 'enable loading of insecure content, defaults to false') diff --git a/src/options/optionsMain.js b/src/options/optionsMain.js index 2fb9ee6..e599179 100644 --- a/src/options/optionsMain.js +++ b/src/options/optionsMain.js @@ -38,6 +38,7 @@ export default function (inpOptions) { fastQuit: inpOptions.fastQuit || false, userAgent: inpOptions.userAgent, ignoreCertificate: inpOptions.ignoreCertificate || false, + disableGpu: inpOptions.disableGpu || false, ignoreGpuBlacklist: inpOptions.ignoreGpuBlacklist || false, enableEs3Apis: inpOptions.enableEs3Apis || false, insecure: inpOptions.insecure || false,