[GH-ISSUE #393] OpenSpotifyLinkFromClipboard does not work on Wayland #1145

Closed
opened 2026-03-14 13:39:27 +03:00 by kerem · 16 comments
Owner

Originally created by @sewnie on GitHub (Mar 11, 2024).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/393

Describe the bug
The action OpenSpotifyLinkFromClipboard to paste a spotify URL in spotify_player does not function on Wayland

To Reproduce

  1. Be on Wayland, no Xwayland
  2. Perform the action
  3. Observe logs

Expected behaviour
It will get pasted and opened

Log and backtrace

2024-03-11T17:09:02.878456Z ERROR terminal_event{event=Key(KeyEvent { code: Char('O'), modifiers: KeyModifiers(SHIFT), kind: Press, state: KeyEventState(0x0) })}: spotify_player::event: Failed to handle event: get clipboard's content: XCB - couldn't establish conection: DisplayParsingError(DisplayNotSet)
2024-03-11T17:09:06.238562Z ERROR terminal_event{event=Key(KeyEvent { code: Char('O'), modifiers: KeyModifiers(SHIFT), kind: Press, state: KeyEventState(0x0) })}: spotify_player::event: Failed to handle event: get clipboard's content: XCB - couldn't establish conection: DisplayParsingError(DisplayNotSet)
Originally created by @sewnie on GitHub (Mar 11, 2024). Original GitHub issue: https://github.com/aome510/spotify-player/issues/393 **Describe the bug** The action OpenSpotifyLinkFromClipboard to paste a spotify URL in spotify_player does not function on Wayland **To Reproduce** 1. Be on Wayland, no Xwayland 2. Perform the action 3. Observe logs **Expected behaviour** It will get pasted and opened **Log and backtrace** ``` 2024-03-11T17:09:02.878456Z ERROR terminal_event{event=Key(KeyEvent { code: Char('O'), modifiers: KeyModifiers(SHIFT), kind: Press, state: KeyEventState(0x0) })}: spotify_player::event: Failed to handle event: get clipboard's content: XCB - couldn't establish conection: DisplayParsingError(DisplayNotSet) 2024-03-11T17:09:06.238562Z ERROR terminal_event{event=Key(KeyEvent { code: Char('O'), modifiers: KeyModifiers(SHIFT), kind: Press, state: KeyEventState(0x0) })}: spotify_player::event: Failed to handle event: get clipboard's content: XCB - couldn't establish conection: DisplayParsingError(DisplayNotSet) ```
kerem 2026-03-14 13:39:27 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@aome510 commented on GitHub (Mar 12, 2024):

The error is pretty self-explained: DisplayParsingError(DisplayNotSet). Can you try to run in the terminal the copy_command in your config (default to xclip -sel c for linux) to see if that works?

You can also try different copy_command, e.g the one recommended for wayland

<!-- gh-comment-id:1989866445 --> @aome510 commented on GitHub (Mar 12, 2024): The error is pretty self-explained: `DisplayParsingError(DisplayNotSet)`. Can you try to run in the terminal the `copy_command` in your config (default to `xclip -sel c` for linux) to see if that works? You can also try different `copy_command`, e.g the one recommended for wayland
Author
Owner

@sewnie commented on GitHub (Mar 12, 2024):

Thats for copying. This issue is for pasting.

The routines used for copying execute_copy_command is not specific to a system clipboard, unlike pasting, which uses a library and imports XCB. That is why it doesn't work, because the logs are from a library not a specific program error.

<!-- gh-comment-id:1990510610 --> @sewnie commented on GitHub (Mar 12, 2024): Thats for copying. This issue is for pasting. The routines used for copying `execute_copy_command` is not specific to a system clipboard, unlike pasting, which uses a library and imports XCB. That is why it doesn't work, because the logs are from a library not a specific program error.
Author
Owner

@aome510 commented on GitHub (Mar 12, 2024):

ahhh, my bad. Will see if there is a way to fix this with the copypasta library.

<!-- gh-comment-id:1991814241 --> @aome510 commented on GitHub (Mar 12, 2024): ahhh, my bad. Will see if there is a way to fix this with the `copypasta` library.
Author
Owner

@sewnie commented on GitHub (Apr 16, 2024):

Yay

<!-- gh-comment-id:2058183596 --> @sewnie commented on GitHub (Apr 16, 2024): Yay
Author
Owner

@aome510 commented on GitHub (Apr 16, 2024):

https://github.com/alacritty/copypasta has support for wayland but it's pretty limited (require window pointer for clipboard access). #411 replaces use of library with paste_command (similar to copy_command), so you should be able to define custom one for your use case

<!-- gh-comment-id:2058184070 --> @aome510 commented on GitHub (Apr 16, 2024): https://github.com/alacritty/copypasta has support for wayland but it's pretty limited (require window pointer for clipboard access). #411 replaces use of library with `paste_command` (similar to `copy_command`), so you should be able to define custom one for your use case
Author
Owner

@sewnie commented on GitHub (Apr 19, 2024):

It does not function:

2024-04-19T07:49:17.303701Z ERROR terminal_event{event=Key(KeyEvent { code: Enter, modifiers: KeyModifiers(0x0), kind: Press, state: KeyEventState(0x0) })}: spotify_player::event: Failed to handle event: No such file or directory (os error 2)
<!-- gh-comment-id:2065997561 --> @sewnie commented on GitHub (Apr 19, 2024): It does not function: ``` 2024-04-19T07:49:17.303701Z ERROR terminal_event{event=Key(KeyEvent { code: Enter, modifiers: KeyModifiers(0x0), kind: Press, state: KeyEventState(0x0) })}: spotify_player::event: Failed to handle event: No such file or directory (os error 2) ```
Author
Owner

@aome510 commented on GitHub (Apr 19, 2024):

Did you define a new paste_command? The default is xclip

<!-- gh-comment-id:2066537440 --> @aome510 commented on GitHub (Apr 19, 2024): Did you define a new `paste_command`? The default is `xclip`
Author
Owner

@sewnie commented on GitHub (Apr 19, 2024):

What? You said the new library doesn't require that anymore, and is automatic.

<!-- gh-comment-id:2066548736 --> @sewnie commented on GitHub (Apr 19, 2024): What? You said the new library doesn't require that anymore, and is automatic.
Author
Owner

@sewnie commented on GitHub (Apr 19, 2024):

Wait. Now I'm confused, earlier it was using this library which was automatic? Why did copying need a command then..?

<!-- gh-comment-id:2066552099 --> @sewnie commented on GitHub (Apr 19, 2024): Wait. Now I'm confused, earlier it was using this library which was automatic? Why did copying need a command then..?
Author
Owner

@aome510 commented on GitHub (Apr 19, 2024):

I didn't say anything about using library and is automatic. I did say

[the PR] replaces use of library with paste_command (similar to copy_command), so you should be able to define custom one for your use case

Library supports wayland but is limited and not easy to integrate to the application

<!-- gh-comment-id:2066578042 --> @aome510 commented on GitHub (Apr 19, 2024): I didn't say anything about using library and is automatic. I did say > [the PR] replaces use of library with paste_command (similar to copy_command), so you should be able to define custom one for your use case Library supports `wayland` but is limited and not easy to integrate to the application
Author
Owner

@sewnie commented on GitHub (Apr 19, 2024):

Sorry for the misunderstanding, and that is very unfortunate. I've scoured all over GitHub for any other suitable clipboard libraries and it seems there isn't. Don't get me wrong, using the copy_command and paste_command approach is acceptable, but it's very inconvenient for your users, including myself.

Programs such as helix have many many checks for a suitable clipboard provider, and yazi executing all clipboard providers for a suitable one. I suggest you take the helix approach (seen here). Again, it is very unfortunate Rust does not have a universal clipboard :(

<!-- gh-comment-id:2066613724 --> @sewnie commented on GitHub (Apr 19, 2024): Sorry for the misunderstanding, and that is very unfortunate. I've scoured all over GitHub for any other suitable clipboard libraries and it seems there isn't. Don't get me wrong, using the `copy_command` and `paste_command` approach is acceptable, but it's very inconvenient for your users, including myself. Programs such as helix have many many checks for a suitable clipboard provider, and yazi executing all clipboard providers for a suitable one. I suggest you take the helix approach (seen [here](https://github.com/blaggacao/helix/blob/master/helix-view/src/clipboard.rs#L59)). Again, it is very unfortunate Rust does not have a universal clipboard :(
Author
Owner

@aome510 commented on GitHub (Apr 19, 2024):

Thanks for the suggestion. I'll think about what is the best way to handle this

<!-- gh-comment-id:2066695546 --> @aome510 commented on GitHub (Apr 19, 2024): Thanks for the suggestion. I'll think about what is the best way to handle this
Author
Owner

@aome510 commented on GitHub (Apr 21, 2024):

@apprehensions implemented in #421. Can you try the latest master?

<!-- gh-comment-id:2068138857 --> @aome510 commented on GitHub (Apr 21, 2024): @apprehensions implemented in #421. Can you try the latest `master`?
Author
Owner

@sewnie commented on GitHub (Apr 22, 2024):

You might want to consider running some of these commands in the background, running wl-copy causes spotify_player to freeze because wl-copy needs to run in the background.

<!-- gh-comment-id:2068316626 --> @sewnie commented on GitHub (Apr 22, 2024): You might want to consider running some of these commands in the background, running `wl-copy` causes spotify_player to freeze because `wl-copy` needs to run in the background.
Author
Owner

@sewnie commented on GitHub (Apr 22, 2024):

Scratch that, i'm not sure why this doesn't work, but it should.

I have this same issue with my editor and i don't know why.

<!-- gh-comment-id:2068319451 --> @sewnie commented on GitHub (Apr 22, 2024): Scratch that, i'm not sure why this doesn't work, but it should. I have this same issue with my editor and i don't know why.
Author
Owner

@aome510 commented on GitHub (Apr 22, 2024):

Not sure what happened. I don't have linux machine, so couldn't really test the change myself. I do think that I implemented the command spawning logic similar to helix

<!-- gh-comment-id:2069497199 --> @aome510 commented on GitHub (Apr 22, 2024): Not sure what happened. I don't have linux machine, so couldn't really test the change myself. I do think that I implemented the command spawning logic similar to `helix`
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#1145
No description provided.