Skip to content

Commit

Permalink
Added Commandline Options (#235)
Browse files Browse the repository at this point in the history
* Added CLI options
* Add description for disable-hardware-acceleration flag to README
  • Loading branch information
Jens Tangermann authored and hql287 committed Mar 7, 2018
1 parent 4000314 commit 929db27
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ Windows 7 and later are supported

[More information](https://github.com/electron/electron/blob/master/docs/tutorial/supported-platforms.md).

Note that on Linux, some users might experience a GPU bug where the select options rendered as a black box, see [issue #128 of Manta](https://github.com/hql287/Manta/pull/128) and [issue #4322 of Electron](https://github.com/electron/electron/issues/4322). This can be fixed by disabling hardware acceleration like so:

```sh
manta --disable-hardware-acceleration
```

> Remember that doing this might lead to some degradation of the app's performance. This is why "the fix" is not included by default.
### Technologies
* [Electron](https://github.com/electron/electron)
* [React](https://github.com/facebook/react)
Expand Down
18 changes: 9 additions & 9 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const { autoUpdater } = require('electron-updater');
// Place a BrowserWindow in center of primary display
const centerOnPrimaryDisplay = require('./helpers/center-on-primary-display');

// Prevent Linux GPU Bug
// https://github.com/electron/electron/issues/4322
if (process.platform == 'linux') {
// commmandline arguments
const forceDevtools = process.argv.includes('--force-devtools');
if (process.argv.includes('--disable-hardware-acceleration')) {
app.disableHardwareAcceleration();
}

Expand Down Expand Up @@ -62,11 +62,11 @@ function createTourWindow() {
);
// Add Event Listeners
tourWindow.on('show', event => {
if (isDev) tourWindow.webContents.openDevTools({ mode: 'detach' });
if (isDev || forceDevtools) tourWindow.webContents.openDevTools({ mode: 'detach' });
});
tourWindow.on('close', event => {
event.preventDefault();
if (isDev) tourWindow.webContents.closeDevTools();
if (isDev || forceDevtools) tourWindow.webContents.closeDevTools();
tourWindow.hide();
});
}
Expand Down Expand Up @@ -101,12 +101,12 @@ function createMainWindow() {
);
// Add Event Listeners
mainWindow.on('show', event => {
if (isDev) mainWindow.webContents.openDevTools({ mode: 'detach' });
if (isDev || forceDevtools) mainWindow.webContents.openDevTools({ mode: 'detach' });
});
mainWindow.on('close', event => {
if (process.platform === 'darwin') {
event.preventDefault();
if (isDev) mainWindow.webContents.closeDevTools();
if (isDev || forceDevtools) mainWindow.webContents.closeDevTools();
mainWindow.hide();
} else {
app.quit();
Expand Down Expand Up @@ -144,11 +144,11 @@ function createPreviewWindow() {
);
// Add Event Listener
previewWindow.on('show', event => {
if (isDev) previewWindow.webContents.openDevTools({ mode: 'detach' });
if (isDev || forceDevtools) previewWindow.webContents.openDevTools({ mode: 'detach' });
});
previewWindow.on('close', event => {
event.preventDefault();
if (isDev) previewWindow.webContents.closeDevTools();
if (isDev || forceDevtools) previewWindow.webContents.closeDevTools();
previewWindow.hide();
});
}
Expand Down

0 comments on commit 929db27

Please sign in to comment.