Let's make it all pretty, shall we?
We missed a couple directories with previous attempts to turn this on globally: app/ and libtextsecure/ Not to mention files in places we didn't expect: ts files that weren't in the ts directory! This turns prettier on for every file we care about (js, ts, tsx, md) everywhere in the project but for a few key parts.
This commit is contained in:
parent
df9c4d5629
commit
754d65ae2e
20 changed files with 1756 additions and 1542 deletions
|
@ -1,10 +1,6 @@
|
|||
const path = require('path');
|
||||
|
||||
const {
|
||||
app,
|
||||
Menu,
|
||||
Tray,
|
||||
} = require('electron');
|
||||
const { app, Menu, Tray } = require('electron');
|
||||
|
||||
let trayContextMenu = null;
|
||||
let tray = null;
|
||||
|
@ -12,7 +8,12 @@ let tray = null;
|
|||
function createTrayIcon(getMainWindow, messages) {
|
||||
// A smaller icon is needed on macOS
|
||||
const iconSize = process.platform === 'darwin' ? '16' : '256';
|
||||
const iconNoNewMessages = path.join(__dirname, '..', 'images', `icon_${iconSize}.png`);
|
||||
const iconNoNewMessages = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'images',
|
||||
`icon_${iconSize}.png`
|
||||
);
|
||||
|
||||
tray = new Tray(iconNoNewMessages);
|
||||
|
||||
|
@ -42,24 +43,28 @@ function createTrayIcon(getMainWindow, messages) {
|
|||
// context menu, since the 'click' event may not work on all platforms.
|
||||
// For details please refer to:
|
||||
// https://github.com/electron/electron/blob/master/docs/api/tray.md.
|
||||
trayContextMenu = Menu.buildFromTemplate([{
|
||||
id: 'toggleWindowVisibility',
|
||||
label: messages[mainWindow.isVisible() ? 'hide' : 'show'].message,
|
||||
click: tray.toggleWindowVisibility,
|
||||
},
|
||||
{
|
||||
id: 'quit',
|
||||
label: messages.quit.message,
|
||||
click: app.quit.bind(app),
|
||||
}]);
|
||||
trayContextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
id: 'toggleWindowVisibility',
|
||||
label: messages[mainWindow.isVisible() ? 'hide' : 'show'].message,
|
||||
click: tray.toggleWindowVisibility,
|
||||
},
|
||||
{
|
||||
id: 'quit',
|
||||
label: messages.quit.message,
|
||||
click: app.quit.bind(app),
|
||||
},
|
||||
]);
|
||||
|
||||
tray.setContextMenu(trayContextMenu);
|
||||
};
|
||||
|
||||
tray.updateIcon = (unreadCount) => {
|
||||
tray.updateIcon = unreadCount => {
|
||||
if (unreadCount > 0) {
|
||||
const filename = `${String(unreadCount >= 10 ? 10 : unreadCount)}.png`;
|
||||
tray.setImage(path.join(__dirname, '..', 'images', 'alert', iconSize, filename));
|
||||
tray.setImage(
|
||||
path.join(__dirname, '..', 'images', 'alert', iconSize, filename)
|
||||
);
|
||||
} else {
|
||||
tray.setImage(iconNoNewMessages);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue