Skip to content

Conversation

@ImMALWARE
Copy link

It shows track playing progress in taskbar:
image
On pause:
image
Resolves #2416

@ImMALWARE
Copy link
Author

@ArjixWasTaken can you review?

Comment on lines +16 to +22
if (
!songInfo?.title ||
typeof songInfo.elapsedSeconds !== 'number' ||
!songInfo.songDuration
) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be better to use zod here

Comment on lines +42 to +53
progressInterval = setInterval(() => {
if (
lastSongInfo &&
!lastSongInfo.isPaused &&
typeof lastSongInfo.elapsedSeconds === 'number'
) {
updateProgressBar({
...lastSongInfo,
elapsedSeconds: lastSongInfo.elapsedSeconds + 1,
});
}
}, 1000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an interval is not guaranteed to run on a precise manner, could you maybe refactor this to not depend on the interval, and maybe calculate the elapsedSeconds using an external variable?

e.g.

const intervalStart = performance.now(); setInterval(() => { const elapsedSeconds = (performance.now() - intervalStart) / 1000; // ... }, 1000)
export default createPlugin({
name: () => t('plugins.taskbar-progress.name'),
description: () => t('plugins.taskbar-progress.description'),
restartNeeded: true,
Copy link
Member

@ArjixWasTaken ArjixWasTaken Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please properly implement the cleanup logic required to turn this into restartNeeded: false, you just need to cleanup some intervals

you cannot unregister the song info callback, but you can remove all side-effects when the plugin is disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants