So a while back I posted this video on getting osu! working on linux. It was incredibly low effort (like so low effort I cringe just watching it) so I thought it was hilarious it even has gained the views it has, but whatever. There has always been numerous guides on the internet regarding osu! Linux support, but I've found the best, tried and true method for getting it to just work is to use the Lutris installer. It's not perfect, but it doesn't require any of the tedious tinkering many of the other guides suggest.
Now thankfully, osu!lazer is becoming more and more feature complete as the days go by, so soon we will see it eventually support online play, which has full Linux support, but in the mean time wine is where it's at.
Wine is to the point that, with the easy tweak scripts provided by Lutris, the ability to run osu! (and many other Windows only games) on Linux is pretty much flawless. Even the bugs I encountered in the video I made don't seem to happen anymore, at least for me, so it seems things have improved even in the last year or so.
One thing that has changed though is Discord-RPC. You might notice, if you check the Lutris install script, that it fetches a discord-rpc.dll to override the one osu! (used to) provide. Why?
Well the reason goes back to the differences in Windows vs Linux IPC (Inter-process communication). Discord RPC on Linux uses UNIX sockets for games to communicate with the discord client, but not for Windows of course. The modified discord-rpc.dll file was designed to translate the Windows Named pipe (how discord and games communicate on wind0ws) to something Linux can understand, and thus worked with the Linux client. Unfortunately, due to some changes, discord-rpc.dll is no longer in use by osu! it seems, so the file gets instantly deleted from the install, regardless if you copy the modified dll or dll that was originally included discord-rpc.dll file.
Anyhow, back to wine. Since wine implements Windows functionality, including named pipes, I wondered why can't we just get the Windows version of Discord working. This actually worked, to my surprise, as I know Chromium (which Discord uses in the background) has traditionally not played well with Wine. Seems wine has improved immensely in that regard.
The new ("easy") solution I use now for getting Discord RPC working with osu! on linux is to merely run Discord's windows client itself on the same wine prefix as osu! is running on.
What's a wine prefix? Think of it like a "virtual" install of Windows, only, it's wine. Given how wine is finnicky at best sometimes, the general practice is to install each application, or game, in a unique prefix. This is because depending on the app, sometimes an app requires dependencies that are incompatible with another app. This isn't always because the app itself would behave this way in Windows, but because some libraries may not work for wine unless it's appearing as a different version of windows.
Anyhow, we can't follow the general "each app in it's own prefix" philosophy in this case, since each instance of wine cannot communicate with each other. Instead, you need discord to run in the same prefix as osu!
Thankfully, it appears Discord will generally install nicely on wine of any recent version. You do seem to need .net installed for it to work, but after that the installer, and client will load up correctly. osu! requires .net anyway (lutris installs 4.5.2) so since we're going to be installing discord in the same prefix, we don't need to worry about any winetricks.
There are a couple key changes you will need to make in winecfg first however. First, you need to change Wine's windows version from "Windows 2003" to "Windows 7". In case you're wondering why it's Windows 2003 to begin with: Lutris calls on winetricks to install .net 4.5.2 (as is necessary). Part of this "winetrick" is to set the Windows version to Windows 2003 to work around some bugs that it would otherwise encounter. Now, I'm not certain if those bugs are just related to installing .net itself, or with certain functions that are incompatible otherwise in .net (perhaps there are bug reports on winehq or with winetricks that discuss this), but I've not encounted any bugs doing this regarding discord + osu!
I did, however, try setting it to Windows 10 as well, but setting this causes super amounts of lag to the osu! client when you attempt to search your beatmaps, so if you feel Windows 10 might be a better choice, I advise you don't. Still, your milage may vary. Consider yourself warned if you decide to play with this.
Next, and this is important otherwise the discord client would eat my mouse due to this bug, you need to disable your Window manager from decorating Wine Windows, which is on the graphics tab of winecfg.
Once you've made these two tweaks, installing and using discord seems to work fine, and as long as osu! is running after you've opened the windows version of Discord, RPC will work. If this is all you're after then problem solved! Enjoy your discord RPC integration in osu!. Just remember to launch discord in the same prefix before osu! to get RPC integration.
Okay now for some additional ramblings not really related to Discord RPC + osu! on Linux.
You may now find yourself being tempted to switch to the Windows discord client and dumping the linux client. It appears to work at first glance, right? So why have a notorious electron app running twice in the background anyway?
First off: I was pleasantly surprised at just how much of the client is functional. However, as soon as you make a call or join a voice channel, you'll probably notice the problem. Discord will crash, reload, then reattempt to join again, only to crash again since joining is what caused this issue in the first place. Rinse, repeat. If you happen to have the debug info, you'll probably notice the console output say:
wine: Call from 0x7b031dbf to unimplemented function qwave.dll.QOSAddSocketToFlow, aborting
wine: Unimplemented function qwave.dll.QOSAddSocketToFlow called at address 7B031DBF (thread 00f0), starting debugger...
It seems qwave.dll in Wine is just a stub library, which discord makes a call to for an unimplemented function that doesn't exist in the dll, causing the app to crash. Thankfully, this library isn't too special in that you can easily trade in this DLL for one from Windows and wine will work with this just fine.
Now just to be clear, swapping out dlls in wine for windows ones probably violates some Microsoft license, not to mention it can result in catastrophic behavior from wine, but that's up to you to deal with. Let's just say though, that there are a number of websites on the internet that allow you to download this DLL. Just make sure you get one from something like Windows 7, since I read somewhere there are API calls in newer versions of this said library that Wine doesn't support yet. I went with a version 6.0.6001.18000 of the DLL, which I think is from Windows Vista since NT 6.0 was Vista.
You will need to get the 32bit version of this dll and paste it into your
system32 directory of the wine prefix. If you happen to be using a 64bit prefix, then you will need to paste it into your
syswow64 directory instead. In my case, syswow64 doesn't exist as Lutris just makes a 32bit prefix for osu!, so mine was located at
Once I did this, I went to winecfg, went to the DLL Overrides section and changed qwave to native since this is a native DLL, not a wine dll, then just restart discord. Now, connecting to voice channels works perfectly in wine. Hooray!
Now all that's left is to make an easy to use shortcut to launch discord. I did this in Lutris by just hitting the + button in the top left, click "Add Game", enter in the name Discord and pick wine as the runner. Finally, and this is important, you need to clone all of the settings you have from osu! as this runs in the same prefix except for the executable. Be sure to toggle "Show advanced options" at the bottom to see them all. For me, the options are setting the executable (For me, I just set
/home/jsebean/Games/osu/drive_c/users/jsebean/Desktop/Discord.lnk). Fore prefix, it's
/home/jsebean/Games/osu, set 32bit for the prefix, set the wine version to be identical, and whatever other options are set. Typically "reduce pulseaudio latency" is also set, but I turned this off.
After all that Discord should get it's own launcher in Lutris and you can easily create a shortcut. Everything seems to work now :)
Now here's to hoping we might see this API become available in wine so all this hackery wont be needed in the future.
UPDATE: It appears this bug has been fixed and everything should work fine in wine 5.4. It has also been backported to 5.0.1.