From bb5122a1a2d25e7ff9d295dfd994e5bfb831b6ea Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Fri, 4 Jun 2021 14:40:05 +0200 Subject: [PATCH] fix: indicator throwing error when task is not found --- electron/indicator.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/electron/indicator.ts b/electron/indicator.ts index 68383f20c..8bbd237ea 100644 --- a/electron/indicator.ts +++ b/electron/indicator.ts @@ -1,5 +1,4 @@ import { App, ipcMain, Menu, nativeTheme, Tray } from 'electron'; -// const dbus = require('./dbus'); import { IPC } from './ipc-events.const'; import { getSettings } from './get-settings'; import { getWin } from './main-window'; @@ -10,8 +9,6 @@ let DIR: string; let shouldUseDarkColors: boolean; const IS_MAC = process.platform === 'darwin'; -const isGnomeShellExtensionRunning = false; - export const initIndicator = ({ showApp, quitApp, @@ -41,9 +38,9 @@ export const initIndicator = ({ }); isIndicatorRunning = true; return tray; - // } }; +// eslint-disable-next-line prefer-arrow/prefer-arrow-functions function initAppListeners(app) { if (tray) { app.on('before-quit', () => { @@ -54,6 +51,7 @@ function initAppListeners(app) { } } +// eslint-disable-next-line prefer-arrow/prefer-arrow-functions function initListeners() { ipcMain.on(IPC.SET_PROGRESS_BAR, (ev, { progress }) => { const suf = shouldUseDarkColors ? '-d' : '-l'; @@ -109,6 +107,7 @@ function initListeners() { // }); } +// eslint-disable-next-line prefer-arrow/prefer-arrow-functions function createIndicatorStr(task): string { if (task && task.title) { let title = task.title; @@ -132,8 +131,12 @@ function createIndicatorStr(task): string { // msg = title + ' | ' + timeStr + 'm '; // return msg; } + + // NOTE: we need to make sure that this is always a string + return ''; } +// eslint-disable-next-line prefer-arrow/prefer-arrow-functions function createContextMenu(showApp, quitApp) { return Menu.buildFromTemplate([ { @@ -147,12 +150,9 @@ function createContextMenu(showApp, quitApp) { ]); } -export const isRunning = () => { - return isIndicatorRunning || isGnomeShellExtensionRunning; -}; - let curIco: string; +// eslint-disable-next-line prefer-arrow/prefer-arrow-functions function setTrayIcon(tr: Tray, icoPath: string) { if (icoPath !== curIco) { curIco = icoPath;