From 14d2364fc69e0222133115c55a36286986006098 Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Fri, 15 Oct 2021 09:48:06 +0200 Subject: chore: update eslint setup (#2074) --- src/lib/Tray.js | 53 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'src/lib/Tray.js') diff --git a/src/lib/Tray.js b/src/lib/Tray.js index 7360611cd..e7afc3552 100644 --- a/src/lib/Tray.js +++ b/src/lib/Tray.js @@ -1,5 +1,11 @@ import { - app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain, + app, + Menu, + nativeImage, + nativeTheme, + systemPreferences, + Tray, + ipcMain, } from 'electron'; import { join } from 'path'; import macosVersion from 'macos-version'; @@ -65,7 +71,9 @@ export default class TrayIcon { if (appSettings.type === 'app') { const { isAppMuted } = appSettings.data; - this.trayMenuTemplate[1].label = isAppMuted ? 'Enable Notifications && Audio' : 'Disable Notifications && Audio'; + this.trayMenuTemplate[1].label = isAppMuted + ? 'Enable Notifications && Audio' + : 'Disable Notifications && Audio'; this.trayMenu = Menu.buildFromTemplate(this.trayMenuTemplate); if (isLinux) { this.trayIcon.setContextMenu(this.trayMenu); @@ -108,9 +116,12 @@ export default class TrayIcon { } if (isMac) { - this.themeChangeSubscriberId = systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { - this._refreshIcon(); - }); + this.themeChangeSubscriberId = systemPreferences.subscribeNotification( + 'AppleInterfaceThemeChangedNotification', + () => { + this._refreshIcon(); + }, + ); } } @@ -150,7 +161,8 @@ export default class TrayIcon { _getAssetFromIndicator(indicator) { if (indicator === '•') { return INDICATOR_TRAY_INDIRECT; - } if (indicator !== 0) { + } + if (indicator !== 0) { return INDICATOR_TRAY_UNREAD; } return INDICATOR_TRAY_PLAIN; @@ -159,11 +171,16 @@ export default class TrayIcon { _refreshIcon() { if (!this.trayIcon) return; - this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator))); + this.trayIcon.setImage( + this._getAsset('tray', this._getAssetFromIndicator(this.indicator)), + ); if (isMac) { this.trayIcon.setPressedImage( - this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`), + this._getAsset( + 'tray', + `${this._getAssetFromIndicator(this.indicator)}-active`, + ), ); } } @@ -171,12 +188,24 @@ export default class TrayIcon { _getAsset(type, asset) { let { platform } = process; - if (isMac && (nativeTheme.shouldUseDarkColors || macosVersion.isGreaterThanOrEqualTo('11'))) { + if ( + isMac && + (nativeTheme.shouldUseDarkColors || + macosVersion.isGreaterThanOrEqualTo('11')) + ) { platform = `${platform}-dark`; } - return nativeImage.createFromPath(join( - __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`, - )); + return nativeImage.createFromPath( + join( + __dirname, + '..', + 'assets', + 'images', + type, + platform, + `${asset}.${FILE_EXTENSION}`, + ), + ); } } -- cgit v1.2.3-54-g00ecf