Merge pull request #128 from jnugh/linuxTrayIcon
Manually merged. Conflicts: src/browser/settings.jsx src/common/settings.js
This commit is contained in:
@@ -486,6 +486,21 @@ var showUnreadBadgeOSX = function(unreadCount, mentionCount) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var showUnreadBadgeLinux = function(unreadCount, mentionCount) {
|
||||||
|
/*if (mentionCount > 0) {
|
||||||
|
remote.app.dock.setBadge(mentionCount.toString());
|
||||||
|
} else if (unreadCount > 0) {
|
||||||
|
remote.app.dock.setBadge('•');
|
||||||
|
} else {
|
||||||
|
remote.app.dock.setBadge('');
|
||||||
|
}*/
|
||||||
|
|
||||||
|
electron.ipcRenderer.send('update-unread', {
|
||||||
|
unreadCount: unreadCount,
|
||||||
|
mentionCount: mentionCount
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var showUnreadBadge = function(unreadCount, mentionCount) {
|
var showUnreadBadge = function(unreadCount, mentionCount) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
@@ -494,6 +509,10 @@ var showUnreadBadge = function(unreadCount, mentionCount) {
|
|||||||
case 'darwin':
|
case 'darwin':
|
||||||
showUnreadBadgeOSX(unreadCount, mentionCount);
|
showUnreadBadgeOSX(unreadCount, mentionCount);
|
||||||
break;
|
break;
|
||||||
|
case 'linux':
|
||||||
|
console.log(unreadCount);
|
||||||
|
showUnreadBadgeLinux(unreadCount, mentionCount);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,6 +40,7 @@ var SettingsPage = React.createClass({
|
|||||||
teams: this.state.teams,
|
teams: this.state.teams,
|
||||||
hideMenuBar: this.state.hideMenuBar,
|
hideMenuBar: this.state.hideMenuBar,
|
||||||
showTrayIcon: this.state.showTrayIcon,
|
showTrayIcon: this.state.showTrayIcon,
|
||||||
|
trayIconTheme: this.state.trayIconTheme,
|
||||||
disablewebsecurity: this.state.disablewebsecurity,
|
disablewebsecurity: this.state.disablewebsecurity,
|
||||||
version: settings.version
|
version: settings.version
|
||||||
};
|
};
|
||||||
@@ -69,6 +70,11 @@ var SettingsPage = React.createClass({
|
|||||||
showTrayIcon: this.refs.showTrayIcon.getChecked()
|
showTrayIcon: this.refs.showTrayIcon.getChecked()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleChangeTrayIconTheme: function() {
|
||||||
|
this.setState({
|
||||||
|
trayIconTheme: this.refs.trayIconTheme.getValue()
|
||||||
|
});
|
||||||
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var teams_row = (
|
var teams_row = (
|
||||||
<Row>
|
<Row>
|
||||||
@@ -84,10 +90,16 @@ var SettingsPage = React.createClass({
|
|||||||
options.push(<Input key="inputHideMenuBar" id="inputHideMenuBar" ref="hideMenuBar" type="checkbox" label="Hide Menu Bar (Press Alt to show Menu Bar)" checked={ this.state.hideMenuBar }
|
options.push(<Input key="inputHideMenuBar" id="inputHideMenuBar" ref="hideMenuBar" type="checkbox" label="Hide Menu Bar (Press Alt to show Menu Bar)" checked={ this.state.hideMenuBar }
|
||||||
onChange={ this.handleChangeHideMenuBar } />);
|
onChange={ this.handleChangeHideMenuBar } />);
|
||||||
}
|
}
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin' || process.platform === 'linux') {
|
||||||
options.push(<Input key="inputShowTrayIcon" ref="showTrayIcon" type="checkbox" label="Show Icon on Menu Bar (Need to restart the application)" checked={ this.state.showTrayIcon } onChange={ this.handleChangeShowTrayIcon }
|
options.push(<Input key="inputShowTrayIcon" ref="showTrayIcon" type="checkbox" label="Show Icon on Menu Bar (Need to restart the application)" checked={ this.state.showTrayIcon } onChange={ this.handleChangeShowTrayIcon }
|
||||||
/>);
|
/>);
|
||||||
}
|
}
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
options.push(<Input key="inputTrayIconTheme" ref="trayIconTheme" type="select" label="Icon theme (Need to restart the application)" value={ this.state.trayIconTheme } onChange={ this.handleChangeTrayIconTheme }>
|
||||||
|
<option value="light">Light</option>
|
||||||
|
<option value="dark">Dark</option>
|
||||||
|
</Input>);
|
||||||
|
}
|
||||||
options.push(<Input key="inputDisableWebSecurity" ref="disablewebsecurity" type="checkbox" label="Allow mixed content (Enabling allows both secure and insecure content, images and scripts to render and execute. Disabling allows only secure content.)"
|
options.push(<Input key="inputDisableWebSecurity" ref="disablewebsecurity" type="checkbox" label="Allow mixed content (Enabling allows both secure and insecure content, images and scripts to render and execute. Disabling allows only secure content.)"
|
||||||
checked={ this.state.disablewebsecurity } onChange={ this.handleChangeDisableWebSecurity } />);
|
checked={ this.state.disablewebsecurity } onChange={ this.handleChangeDisableWebSecurity } />);
|
||||||
var options_row = (options.length > 0) ? (
|
var options_row = (options.length > 0) ? (
|
||||||
|
@@ -24,6 +24,7 @@ var loadDefault = function(version) {
|
|||||||
teams: [],
|
teams: [],
|
||||||
hideMenuBar: false,
|
hideMenuBar: false,
|
||||||
showTrayIcon: false,
|
showTrayIcon: false,
|
||||||
|
trayIconTheme: '',
|
||||||
disablewebsecurity: true,
|
disablewebsecurity: true,
|
||||||
version: 1
|
version: 1
|
||||||
};
|
};
|
||||||
|
@@ -63,6 +63,13 @@ const trayImages = function() {
|
|||||||
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconUnreadTemplate.png')),
|
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconUnreadTemplate.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconMentionTemplate.png'))
|
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconMentionTemplate.png'))
|
||||||
};
|
};
|
||||||
|
case 'linux':
|
||||||
|
var resourcesDir = 'resources/linux/' + (config.trayIconTheme || 'light') + '/';
|
||||||
|
return {
|
||||||
|
normal: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconTemplate.png')),
|
||||||
|
unread: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconUnreadTemplate.png')),
|
||||||
|
mention: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconMentionTemplate.png'))
|
||||||
|
};
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -73,7 +80,7 @@ function shouldShowTrayIcon() {
|
|||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (process.platform === 'darwin' && config.showTrayIcon === true) {
|
if (['darwin', 'linux'].includes(process.platform) && config.showTrayIcon === true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
BIN
src/resources/linux/dark/MenuIconMentionTemplate.png
Normal file
BIN
src/resources/linux/dark/MenuIconMentionTemplate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
src/resources/linux/dark/MenuIconTemplate.png
Normal file
BIN
src/resources/linux/dark/MenuIconTemplate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
src/resources/linux/dark/MenuIconUnreadTemplate.png
Normal file
BIN
src/resources/linux/dark/MenuIconUnreadTemplate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
src/resources/linux/light/MenuIconMentionTemplate.png
Normal file
BIN
src/resources/linux/light/MenuIconMentionTemplate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
src/resources/linux/light/MenuIconTemplate.png
Normal file
BIN
src/resources/linux/light/MenuIconTemplate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 836 B |
BIN
src/resources/linux/light/MenuIconUnreadTemplate.png
Normal file
BIN
src/resources/linux/light/MenuIconUnreadTemplate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user