Format all files with prettier

This commit is contained in:
Andy Balaam
2022-12-15 11:52:12 +00:00
parent 040344eeab
commit 0faac52dae
67 changed files with 1758 additions and 1791 deletions
+12 -12
View File
@@ -25,7 +25,7 @@ import { _t } from "./language-helper";
let trayIcon: Tray | null = null;
export function hasTray(): boolean {
return (trayIcon !== null);
return trayIcon !== null;
}
export function destroy(): void {
@@ -52,17 +52,17 @@ interface IConfig {
export function create(config: IConfig): void {
// no trays on darwin
if (process.platform === 'darwin' || trayIcon) return;
if (process.platform === "darwin" || trayIcon) return;
const defaultIcon = nativeImage.createFromPath(config.icon_path);
trayIcon = new Tray(defaultIcon);
trayIcon.setToolTip(config.brand);
initApplicationMenu();
trayIcon.on('click', toggleWin);
trayIcon.on("click", toggleWin);
let lastFavicon: string | null = null;
global.mainWindow?.webContents.on('page-favicon-updated', async function(ev, favicons) {
if (!favicons || favicons.length <= 0 || !favicons[0].startsWith('data:')) {
global.mainWindow?.webContents.on("page-favicon-updated", async function (ev, favicons) {
if (!favicons || favicons.length <= 0 || !favicons[0].startsWith("data:")) {
if (lastFavicon !== null) {
global.mainWindow?.setIcon(defaultIcon);
trayIcon?.setImage(defaultIcon);
@@ -78,9 +78,9 @@ export function create(config: IConfig): void {
let newFavicon = nativeImage.createFromDataURL(favicons[0]);
// Windows likes ico's too much.
if (process.platform === 'win32') {
if (process.platform === "win32") {
try {
const icoPath = path.join(app.getPath('temp'), 'win32_element_icon.ico');
const icoPath = path.join(app.getPath("temp"), "win32_element_icon.ico");
fs.writeFileSync(icoPath, await pngToIco(newFavicon.toPNG()));
newFavicon = nativeImage.createFromPath(icoPath);
} catch (e) {
@@ -92,7 +92,7 @@ export function create(config: IConfig): void {
global.mainWindow?.setIcon(newFavicon);
});
global.mainWindow?.webContents.on('page-title-updated', function(ev, title) {
global.mainWindow?.webContents.on("page-title-updated", function (ev, title) {
trayIcon?.setToolTip(title);
});
}
@@ -104,13 +104,13 @@ export function initApplicationMenu(): void {
const contextMenu = Menu.buildFromTemplate([
{
label: _t('Show/Hide'),
label: _t("Show/Hide"),
click: toggleWin,
},
{ type: 'separator' },
{ type: "separator" },
{
label: _t('Quit'),
click: function(): void {
label: _t("Quit"),
click: function (): void {
app.quit();
},
},