Skip to content

Commit

Permalink
Merge pull request #190 from nukeop/feature/disable-gpu
Browse files Browse the repository at this point in the history
Allow users to disable GPU rendering. Closes #159
  • Loading branch information
nukeop authored Jan 24, 2019
2 parents afbbebd + 29e60ec commit 8b7947f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 25 deletions.
7 changes: 7 additions & 0 deletions app/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ module.exports = [
prettyName: 'Autoradio',
default: true
},
{
name: 'disableGPU',
category: 'Program settings',
type: 'boolean',
prettyName: 'Disable hardware rendering (might fix issues with dragging elements and flashing screen)',
default: false
},
{
name: 'framelessWindow',
category: 'Program settings',
Expand Down
17 changes: 10 additions & 7 deletions server/main.dev.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const {
default: installExtension,
REACT_DEVELOPER_TOOLS,
REDUX_DEVTOOLS,
REDUX_DEVTOOLS
} = require('electron-devtools-installer');
const {
app,
ipcMain,
nativeImage,
BrowserWindow,
Menu,
Tray,
Tray
} = require('electron');
const platform = require('electron-platform');
const path = require('path');
Expand All @@ -35,8 +35,11 @@ function createWindow () {
show: false,
webPreferences: {
experimentalFeatures: true,
webSecurity: false,
webSecurity: false
},
additionalArguments: [
getOption('disableGPU') && '--disable-gpu'
]
});

win.setTitle('Nuclear Music Player');
Expand All @@ -55,7 +58,7 @@ function createWindow () {
url.format({
pathname: 'localhost:8080',
protocol: 'http:',
slashes: true,
slashes: true
})
);

Expand Down Expand Up @@ -83,8 +86,8 @@ function createWindow () {
type: 'normal',
click: (menuItem, browserWindow, event) => {
app.quit();
},
},
}
}
]);

tray = new Tray(icon);
Expand All @@ -102,7 +105,7 @@ function createWindow () {

ipcMain.on('maximize', () => {
if (platform.isDarwin) {
win.isFullScreen() ? win.setFullScreen(false) : win.setFullScreen(true)
win.isFullScreen() ? win.setFullScreen(false) : win.setFullScreen(true);
} else {
win.isMaximized() ? win.unmaximize() : win.maximize();
}
Expand Down
27 changes: 15 additions & 12 deletions server/main.dev.linux.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import logger from 'electron-timber';
//const { default: installExtension, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } = require('electron-devtools-installer');
// const { default: installExtension, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } = require('electron-devtools-installer');
const { app, ipcMain, nativeImage, BrowserWindow, Menu, Tray } = require('electron');
const platform = require('electron-platform');
const path = require('path');
const url = require('url');
const mpris = require('./mpris');
const getOption = require('./store').getOption;
//var Player;
// var Player;

// GNU/Linux-specific
if (!platform.isDarwin && !platform.isWin32) {
//Player = require('mpris-service');
// Player = require('mpris-service');
}

let win;
Expand All @@ -33,20 +33,23 @@ function createWindow() {
webPreferences: {
experimentalFeatures: true,
webSecurity: false
}
},
additionalArguments: [
getOption('disableGPU') && '--disable-gpu'
]
});

win.setTitle('nuclear music player');

// Needs to be commented for now
// https://github.com/electron/electron/issues/13008
// installExtension(REACT_DEVELOPER_TOOLS)
// .then((name) => console.log(`Added Extension: ${name}`))
// .catch((err) => console.log('An error occurred: ', err));
// Needs to be commented for now
// https://github.com/electron/electron/issues/13008
// installExtension(REACT_DEVELOPER_TOOLS)
// .then((name) => console.log(`Added Extension: ${name}`))
// .catch((err) => console.log('An error occurred: ', err));

// installExtension(REDUX_DEVTOOLS)
// .then((name) => console.log(`Added Extension: ${name}`))
// .catch((err) => console.log('An error occurred: ', err));
// installExtension(REDUX_DEVTOOLS)
// .then((name) => console.log(`Added Extension: ${name}`))
// .catch((err) => console.log('An error occurred: ', err));

win.loadURL(url.format({
pathname: 'localhost:8080',
Expand Down
9 changes: 6 additions & 3 deletions server/main.prod.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require("babel-polyfill");
require('babel-polyfill');
const { app, ipcMain, nativeImage, BrowserWindow, Menu, Tray } = require('electron');
const platform = require('electron-platform');
const path = require('path');
Expand All @@ -23,7 +23,10 @@ function createWindow() {
webPreferences: {
experimentalFeatures: true,
webSecurity: false
}
},
additionalArguments: [
getOption('disableGPU') && '--disable-gpu'
]
});

win.setTitle('Nuclear Music Player');
Expand All @@ -35,7 +38,7 @@ function createWindow() {
}));

win.once('ready-to-show', () => {
win.show()
win.show();
});

win.on('closed', () => {
Expand Down
9 changes: 6 additions & 3 deletions server/main.prod.linux.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require("babel-polyfill");
require('babel-polyfill');
const { app, ipcMain, nativeImage, BrowserWindow, Menu, Tray } = require('electron');
const platform = require('electron-platform');
const path = require('path');
Expand All @@ -25,7 +25,10 @@ function createWindow() {
webPreferences: {
experimentalFeatures: true,
webSecurity: false
}
},
additionalArguments: [
getOption('disableGPU') && '--disable-gpu'
]
});

win.setTitle('nuclear music player');
Expand All @@ -37,7 +40,7 @@ function createWindow() {
}));

win.once('ready-to-show', () => {
win.show()
win.show();
});

win.on('closed', () => {
Expand Down

0 comments on commit 8b7947f

Please sign in to comment.