Skip to content

Commit

Permalink
Ability to hide tray icon. Fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
klaudiosinani committed Oct 20, 2017
1 parent b6b185e commit 1c495dc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = new Config({
},
menuBarVisible: false,
autoNightMode: false,
hideTray: false,
darkMode: false,
blackMode: false,
sepiaMode: false,
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ function createMainWindow() {
app.on('ready', () => {
electron.Menu.setApplicationMenu(appMenu);
mainWindow = createMainWindow();
tray.create(mainWindow);
if (!config.get('hideTray')) {
// Check whether or not the tray
// icon is set to be hidden
tray.create(mainWindow);
}
const windowContent = mainWindow.webContents;

windowContent.on('dom-ready', () => {
Expand Down
9 changes: 9 additions & 0 deletions menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,15 @@ const otherTpl = [{
config.set('alwaysOnTop', item.checked);
focusedWindow.setAlwaysOnTop(item.checked);
}
}, {
label: 'Hide Tray Icon',
type: 'checkbox',
checked: config.get('hideTray'),
click(item) {
config.set('hideTray', item.checked);
app.relaunch();
app.quit();
}
}, {
label: 'Toggle Menu Bar',
type: 'checkbox',
Expand Down
12 changes: 12 additions & 0 deletions tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ exports.create = win => {
}
}, {
type: 'separator'
}, {
label: 'Hide Tray Icon',
type: 'checkbox',
checked: config.get('hideTray'),
click(item) {
showWin();
config.set('hideTray', item.checked);
app.relaunch();
app.quit();
}
}, {
type: 'separator'
}, {
label: `Settings`,
click() {
Expand Down

0 comments on commit 1c495dc

Please sign in to comment.