presence.nvim icon indicating copy to clipboard operation
presence.nvim copied to clipboard

Using Discord RPC on WSL2

Open takase1121 opened this issue 3 years ago • 7 comments

I've been using instructions from this gist for a while now. It works except some occasional bugs. I think this can be put in the wiki.

EDIT: I just realized that was the exact instructions for WSL1. That's mean it works for both systems.

takase1121 avatar Aug 18 '21 05:08 takase1121

Hi @takase1121! Hmmm that's interesting..

I did locally test WSL 2 with socat and npiperelay but ran into issues with the relay connection being closed all the time. I wonder if these instructions in that gist has anything that differs from the WSL 1 steps I noted here. 🤔

I'm a little busy these days but when I have the time I'll see if I can get Rich Presence to work in WSL 2 with the same steps and resolve any of those occasional bugs you're finding.

If you're able to note a checklist of issues that you're observing with the plugin in WSL 2 and/or validate what's stated in the plugin's WSL wiki page, I'd really appreciate it. I may be able to apply fixes for those even if I'm not able to personally get WSL 2 working. In any case thanks for letting me know!

andweeb avatar Aug 18 '21 16:08 andweeb

Hello, i managed to run this in WSL2. Got some random write failed 32: Broken pipe errors but it still works. I used the same instructions as the wiki has for WSL1. Only needed to run this as sudo because of some Operation not permitted errors.

image image

EDIT: It seems that error write failed 32: Broken pipe is triggered when i start neovim without any file (just plain nvim command).

SeRyKii avatar Jul 29 '23 18:07 SeRyKii

Hi! I've tested out the WSL1 configuration on my Arch Linux WSL2 install (kernel 5.15.90.1-microsoft-standard-WSL2) and it works great. I ran into EACCES errors at first but it's because I didn't relog for the discord group to take effect.

For convenience, attached here is a script that cross-compiles npiperelay, creates the discord group, and adds a systemd service that automatically starts the relay on boot: https://gist.github.com/ongyx/6b05e076db3a3243e6721c90c1dc21e6 This should work on any system that uses systemd, but I haven't tested it out on other systems yet.

ongyx avatar Aug 23 '23 15:08 ongyx

I'm still struggling to make this work when I run this command it gets stuck and never executes completely exec socat UNIX-LISTEN:/var/run/discord-ipc-0,fork,group=discord,umask=007 EXEC:"npiperelay.exe -ep -s //./pipe/discord-ipc-0",nofork

Rahim-444 avatar Sep 26 '23 20:09 Rahim-444

I'm still struggling to make this work when I run this command it gets stuck and never executes completely exec socat UNIX-LISTEN:/var/run/discord-ipc-0,fork,group=discord,umask=007 EXEC:"npiperelay.exe -ep -s //./pipe/discord-ipc-0",nofork

It's supposed to get stuck, as long as npiperelay is running on Windows and the named pipe is created then it's working.

takase1121 avatar Sep 26 '23 23:09 takase1121

It's supposed to get stuck, as long as npiperelay is running on Windows and the named pipe is created then it's working.

Well, it doesn't work for my case, I guess it doesn't always work on wsl2.

Rahim-444 avatar Sep 27 '23 13:09 Rahim-444

Hi! I've tested out the WSL1 configuration on my Arch Linux WSL2 install (kernel 5.15.90.1-microsoft-standard-WSL2) and it works great. I ran into EACCES errors at first but it's because I didn't relog for the discord group to take effect.

For convenience, attached here is a script that cross-compiles npiperelay, creates the discord group, and adds a systemd service that automatically starts the relay on boot: https://gist.github.com/ongyx/6b05e076db3a3243e6721c90c1dc21e6 This should work on any system that uses systemd, but I haven't tested it out on other systems yet.

Using this script and after shutting down wsl it works Maybe add this to wiki or official support for wsl2

Edit: Well forget what i said its not stable if close the nvim session then it will not work again until you restart the service i dont know what the problem is also the error write failed 32: Broken pipe comes frequently

Zedai00 avatar Apr 17 '24 05:04 Zedai00