Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the "Show Tray Icon" preference #1215

Merged
merged 6 commits into from
Feb 5, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix the 'Show Tray Icon' option from the preferencesSubmenu.
JBudny committed Dec 11, 2019
commit 81d3510fde9ce2593491563811b394119dfbda31
11 changes: 5 additions & 6 deletions source/menu.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import {existsSync, writeFileSync} from 'fs';
import {app, shell, Menu, MenuItemConstructorOptions, BrowserWindow, dialog} from 'electron';
import {app, shell, Menu, MenuItemConstructorOptions, dialog} from 'electron';
import {
is,
appMenu,
@@ -10,10 +10,11 @@ import {
debugInfo
} from 'electron-util';
import config from './config';
import {sendAction, showRestartDialog} from './util';
import {sendAction, showRestartDialog, getWindow} from './util';
import {generateSubmenu as generateEmojiSubmenu} from './emoji';
import {toggleMenuBarMode} from './menu-bar-mode';
import {caprineIconPath} from './constants';
import tray from './tray';

export default async function updateMenu(): Promise<Menu> {
const newConversationItem: MenuItemConstructorOptions = {
@@ -272,9 +273,7 @@ Press Command/Ctrl+R in Caprine to see your changes.
checked: config.get('menuBarMode'),
click() {
config.set('menuBarMode', !config.get('menuBarMode'));

const [win] = BrowserWindow.getAllWindows();
toggleMenuBarMode(win);
toggleMenuBarMode(getWindow());
}
},
{
@@ -335,7 +334,7 @@ Press Command/Ctrl+R in Caprine to see your changes.
checked: config.get('showTrayIcon'),
click() {
config.set('showTrayIcon', !config.get('showTrayIcon'));
sendAction('toggle-tray-icon');
config.get('showTrayIcon')? tray.create(getWindow()) : tray.destroy();
}
},
{