mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 11:01:45 +00:00
fix: callback for time-changed event (#2577)
Co-authored-by: Derek Alsop <15299183+Azorant@users.noreply.github.com>
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Menu, screen, nativeImage, Tray } from 'electron';
|
||||
import { Menu, nativeImage, screen, Tray } from 'electron';
|
||||
import is from 'electron-is';
|
||||
|
||||
import defaultTrayIconAsset from '@assets/youtube-music-tray.png?asset&asarUnpack';
|
||||
@ -7,7 +7,7 @@ import pausedTrayIconAsset from '@assets/youtube-music-tray-paused.png?asset&asa
|
||||
import config from './config';
|
||||
|
||||
import { restart } from './providers/app-controls';
|
||||
import registerCallback from './providers/song-info';
|
||||
import registerCallback, { SongInfoEvent } from './providers/song-info';
|
||||
import getSongControls from './providers/song-controls';
|
||||
|
||||
import { t } from '@/i18n';
|
||||
@ -125,7 +125,9 @@ export const setUpTray = (app: Electron.App, win: Electron.BrowserWindow) => {
|
||||
const trayMenu = Menu.buildFromTemplate(template);
|
||||
tray.setContextMenu(trayMenu);
|
||||
|
||||
registerCallback((songInfo) => {
|
||||
registerCallback((songInfo, event) => {
|
||||
if (event === SongInfoEvent.TimeChanged) return;
|
||||
|
||||
if (tray) {
|
||||
if (typeof songInfo.isPaused === 'undefined') {
|
||||
tray.setImage(defaultTrayIcon);
|
||||
|
||||
Reference in New Issue
Block a user