Mstrodl / elcord

Discord Rich Presence / Gamebridge support for Emacs!
MIT License
191 stars 45 forks source link

elcord: attempting reconnect on WSL2 #95

Open overanalytcl opened 1 month ago

overanalytcl commented 1 month ago

I am on Windows 11, WSL 2 on Ubuntu 24.04 and Emacs 29.4. I installed elcord on Spacemacs, and yet when I activate elcord-mode, it hangs on elcord: attempting reconnect... This is distinct from both #48 and #70, since I am on WSL (it works perfectly fine on the native build), and as such I don't think the Powershell thing applies to me. Do you have any idea where I can start debugging this?

Mstrodl commented 1 month ago

If you're running emacs in WSL, you'll need to be running Discord in WSL as well. I don't think there's any real way around that.

Mstrodl commented 1 month ago

(On windows, discord uses named pipes, which afaik aren't exported to WSL at all)

overanalytcl commented 1 month ago

(On windows, discord uses named pipes, which afaik aren't exported to WSL at all)

Well, that sucks to hear. I thought RPC would flow from WSL to Discord because it shouldn't be blocked by anything (iirc, there's no firewall). Maybe an intermediate script that could function like stdpipes.ps1 that gets run on the host (so it could have access to WSL2) could work?

Mstrodl commented 1 month ago

Maybe! There might be some clever driver or something that lets you do named pipes directly from WSL? Happy to accept a PR to add support for it!

RangHo commented 3 weeks ago

I used to experiment with npiperelay back in the days I used WSL1. It was for NeoVim, though...

With this solution, you use npiperelay with socat to create a "Discord IPC UNIX socket" yourself. Basically how it works is:

Here is a one-liner, adapted from some sample commands (untested, since I ditched Windows years ago):

socat UNIX-LISTEN:/tmp/discord-ipc-0,fork EXEC:"npiperelay.exe -ep -s //./pipe/discord-ipc-0",nofork