[GH-ISSUE #123] feature request: notifications for tracks #989

Closed
opened 2026-03-14 12:52:29 +03:00 by kerem · 6 comments
Owner

Originally created by @justchokingaround on GitHub (Feb 7, 2023).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/123

The official Spotify client (on linux) sends notifications when a new track is played, or when you reach the end of a song, and the next one starts playing. It would be great if this could be added to spotify-player 👉 👈

Here's an example of how it looks like with the official client:
image

Originally created by @justchokingaround on GitHub (Feb 7, 2023). Original GitHub issue: https://github.com/aome510/spotify-player/issues/123 The official Spotify client (on linux) sends notifications when a new track is played, or when you reach the end of a song, and the next one starts playing. It would be great if this could be added to `spotify-player` :point_right: :point_left: Here's an example of how it looks like with the official client: ![image](https://user-images.githubusercontent.com/44473782/217357525-e0f62cbf-4d6f-42de-b8a4-76ffaee5c714.png)
kerem 2026-03-14 12:52:29 +03:00
Author
Owner

@sewnie commented on GitHub (Feb 8, 2023):

this tbh

<!-- gh-comment-id:1422924009 --> @sewnie commented on GitHub (Feb 8, 2023): this tbh
Author
Owner

@aome510 commented on GitHub (Feb 17, 2023):

@justchokingaround @apprehensions implemented in https://github.com/aome510/spotify-player/pull/137.

You guys can test it out by running cargo run --features notify.

Also @apprehensions, I've implemented the first section in your #103

download the current playing song's album cover into a file or into a cache for another script to use; my usecase for this is to display the album cover with an image viewer, as i missed this feature from playing music with mpv.

You can find the downloaded album covers in $APP_CACHE_FOLDER/images.

<!-- gh-comment-id:1434059786 --> @aome510 commented on GitHub (Feb 17, 2023): @justchokingaround @apprehensions implemented in https://github.com/aome510/spotify-player/pull/137. You guys can test it out by running `cargo run --features notify`. Also @apprehensions, I've implemented the first section in your #103 > download the current playing song's album cover into a file or into a cache for another script to use; my usecase for this is to display the album cover with an image viewer, as i missed this feature from playing music with mpv. You can find the downloaded album covers in `$APP_CACHE_FOLDER/images`.
Author
Owner

@justchokingaround commented on GitHub (Feb 17, 2023):

it works really well, except one minor detail. when you select a song to play and then select another one a few seconds after that, it will display 2 notifications, which is different from the behavior of the official client, where the first song notification gets replaced by the second one. hopefully this screenshot helps you understand:
image

<!-- gh-comment-id:1434871146 --> @justchokingaround commented on GitHub (Feb 17, 2023): it works really well, except one minor detail. when you select a song to play and then select another one a few seconds after that, it will display 2 notifications, which is different from the behavior of the official client, where the first song notification gets replaced by the second one. hopefully this screenshot helps you understand: ![image](https://user-images.githubusercontent.com/44473782/219707716-0bd93cb7-9c28-4884-a283-316edf1829c2.png)
Author
Owner

@sewnie commented on GitHub (Feb 17, 2023):

that is because the notifications have completely seperate ids, if they had the same ids the notification daemon will automatically replace the previous if existing, i hope that can provide a solution

dunstify --replace=293 hi

for example

<!-- gh-comment-id:1435048053 --> @sewnie commented on GitHub (Feb 17, 2023): that is because the notifications have completely seperate ids, if they had the same ids the notification daemon will automatically replace the previous if existing, i hope that can provide a solution ``` dunstify --replace=293 hi ``` for example
Author
Owner

@aome510 commented on GitHub (Feb 18, 2023):

it works really well, except one minor detail. when you select a song to play and then select another one a few seconds after that, it will display 2 notifications, which is different from the behavior of the official client, where the first song notification gets replaced by the second one. hopefully this screenshot helps you understand:

Yeah, you're right. It's because spotify-player creates new notification on each track change event. In theory, it can reuse the previous notification with an update function. I'm not too sure if that'll work well. Will try and get back to you later.

<!-- gh-comment-id:1435467822 --> @aome510 commented on GitHub (Feb 18, 2023): > it works really well, except one minor detail. when you select a song to play and then select another one a few seconds after that, it will display 2 notifications, which is different from the behavior of the official client, where the first song notification gets replaced by the second one. hopefully this screenshot helps you understand: Yeah, you're right. It's because `spotify-player` creates new notification on each track change event. In theory, it can reuse the previous notification with an `update` function. I'm not too sure if that'll work well. Will try and get back to you later.
Author
Owner

@aome510 commented on GitHub (Feb 18, 2023):

@justchokingaround, I did take a look. It's possible to implement updating functionality, but it is not trivial as it's only available in OSes with xdg. In other words, the implementation will involve some flag setup to avoid compilation failing in other OSes (macos, windows). I would avoid doing that if possible.

Hopefully, this is enough for now. I may go back to this in the future.

<!-- gh-comment-id:1435734261 --> @aome510 commented on GitHub (Feb 18, 2023): @justchokingaround, I did take a look. It's possible to implement updating functionality, but it is not trivial as it's only available in OSes with `xdg`. In other words, the implementation will involve some flag setup to avoid compilation failing in other OSes (`macos`, `windows`). I would avoid doing that if possible. Hopefully, this is enough for now. I may go back to this in the future.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#989
No description provided.