Merge pull request #392 from jnugh/linuxTrayIconThemeSettings
Linux tray icon theme settings regression fix
This commit is contained in:
commit
1f11e8efd0
|
@ -1,5 +1,6 @@
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const {Button, Checkbox, Col, FormGroup, Grid, Navbar, Row} = require('react-bootstrap');
|
const ReactDOM = require('react-dom');
|
||||||
|
const {Button, Checkbox, Col, FormGroup, FormControl, ControlLabel, Grid, Navbar, Row} = require('react-bootstrap');
|
||||||
|
|
||||||
const {ipcRenderer, remote} = require('electron');
|
const {ipcRenderer, remote} = require('electron');
|
||||||
const AutoLaunch = require('auto-launch');
|
const AutoLaunch = require('auto-launch');
|
||||||
|
@ -114,7 +115,7 @@ const SettingsPage = React.createClass({
|
||||||
},
|
},
|
||||||
handleChangeTrayIconTheme() {
|
handleChangeTrayIconTheme() {
|
||||||
this.setState({
|
this.setState({
|
||||||
trayIconTheme: !this.refs.trayIconTheme.props.checked
|
trayIconTheme: ReactDOM.findDOMNode(this.refs.trayIconTheme).value
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleChangeAutoStart() {
|
handleChangeAutoStart() {
|
||||||
|
@ -189,16 +190,19 @@ const SettingsPage = React.createClass({
|
||||||
}
|
}
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
options.push(
|
options.push(
|
||||||
<Checkbox
|
<FormGroup>
|
||||||
|
<ControlLabel>{'Icon theme (Need to restart the application)'}</ControlLabel>
|
||||||
|
<FormControl
|
||||||
|
componentClass='select'
|
||||||
key='inputTrayIconTheme'
|
key='inputTrayIconTheme'
|
||||||
ref='trayIconTheme'
|
ref='trayIconTheme'
|
||||||
type='select'
|
|
||||||
value={this.state.trayIconTheme}
|
value={this.state.trayIconTheme}
|
||||||
onChange={this.handleChangeTrayIconTheme}
|
onChange={this.handleChangeTrayIconTheme}
|
||||||
>{'Icon theme (Need to restart the application)'}
|
>
|
||||||
<option value='light'>{'Light'}</option>
|
<option value='light'>{'Light'}</option>
|
||||||
<option value='dark'>{'Dark'}</option>
|
<option value='dark'>{'Dark'}</option>
|
||||||
</Checkbox>);
|
</FormControl>
|
||||||
|
</FormGroup>);
|
||||||
}
|
}
|
||||||
options.push(
|
options.push(
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
|
11
src/main.js
11
src/main.js
|
@ -153,12 +153,21 @@ const trayImages = (() => {
|
||||||
}
|
}
|
||||||
case 'linux':
|
case 'linux':
|
||||||
{
|
{
|
||||||
const theme = config.trayIconTheme || 'light';
|
const theme = config.trayIconTheme;
|
||||||
|
try {
|
||||||
return {
|
return {
|
||||||
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')),
|
||||||
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')),
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png'))
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png'))
|
||||||
};
|
};
|
||||||
|
} catch (e) {
|
||||||
|
//Fallback for invalid theme setting
|
||||||
|
return {
|
||||||
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconTemplate.png')),
|
||||||
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconUnreadTemplate.png')),
|
||||||
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', 'light', 'MenuIconMentionTemplate.png'))
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
|
|
Loading…
Reference in a new issue