Azn9 / JetBrains-Discord-Integration

Discord rich presence integration for all JetBrains IDEs
Apache License 2.0
147 stars 10 forks source link

[Bug]: Could Not Detect Error When Plugin Is Working #188

Closed DaChickenGamer closed 4 weeks ago

DaChickenGamer commented 2 months ago

What happened?

So the Plugin is working fine on my Vesktop client but I'm still getting an error in the plugin page that it could not detect a running discord client.

Screenshot from 2024-08-22 15-32-53

IDE version

IntelliJ IDEA Ultimate 2024.1.4

Plugin version

2.1.3

What operating system are you using?

Linux

Relevant log output

No response

Azn9 commented 2 months ago

May be a regression of #81

TheAyes commented 1 week ago

Seems like it's still happening on linux.

image

OS: Nixos Unstable Discord: Vesktop with arrpc

Miiiight be a nixos thing so I'd wait for someone else to confirm for another platform

Azn9 commented 1 week ago

@TheAyes the plugin uses the command ps xo user:30,command on linux to gather running programs. Can you send me the line corresponding to vesktop so I can add it to the detection? I only added it on Windows atm, as I don't use linux other than for servers 😅

TheAyes commented 1 week ago

So this is going to be tricky... Since by default programs on nixos are installed to the nix stores which contains a semi random hash to avoid conflicts between packages. Which means that every update this would be required to be updated manually (if hardcoded).

I'll have a look to see if I can find a better way of trying to detect it.

TheAyes commented 1 week ago

Alright. There's a couple of issues. firstly the "design choice" I mentioned above will make it a bit tedious. Secondly. Atleast for me there isn't a direct vesktop instance running. The Vesktop binary I execute instead starts several electron instances. This makes it really hard to get the actual command since there's not simply "one" correct answer. Does it suffice if you can check if "any" is running?

If this is the case then modifying the command like this ps xo user:30,command | grep "vesktop" | grep -Eoh '/.+$' | grep -v "grep" | head -1 always yields a result. While this works I have found a shorter variant to do this. however this modifies the original command and I'm unsure if it has any consequences. ps x -o command | grep "/vesktop" | grep -v "grep" | head -1

this always returns "something" if vesktop is running. or nothing if it's not.

Long Command: image

Shorter Command: image

would this help?

P.S.: This might be alot easier on any other distro

Azn9 commented 1 week ago

ps x -o command | grep "/vesktop" | grep -v "grep" | head -1 this always returns "something" if vesktop is running. or nothing if it's not. would this help?

That's exactly what I need, the current check is just something like "is there any line that contains /discord" 😅

P.S.: This might be alot easier on any other distro

I don't know all have their specificities and the different packages managers don't really help 😔

However on windows I added a feature that just test the IPC file and don't care about the client if it can connect to one, I should port that to linux, it would prevent issues like that for other distros/clients 👀