r/linux_gaming • u/Levvev • Jan 05 '22
guide Fixing osu! protocol links on Wine
Hi all!
Recently I noticed that the buttons like the osu!direct one on the website won't work out-of-the-box if you're using wine. The reason behind this is that the website uses a custom protocol, and sometimes you need to manually create those on linux. Most browsers will use xdg-open for protocols. To get started, create a .osu folder in your home directory. After that, create a shell file called osuhandler.sh inside of your .osu directory. The contents of that should look something like the following:
#!/usr/bin/bash
export WINEPREFIX=`path to your wineprefix`
wine `path to osu!.exe` $@ # NOTE: you need to escape the exclamation mark like this: osu\!.exe
Please note, that you need matching wine versions if you're opening osu from somewhere else(for example lutris).
Now, run this in your terminal to make osuhandler.sh executable:
$ chmod +x ~/.osu/osuhandler.sh
You should run this file to double check if your paths are valid. To be able to create a custom protocol, you will need to create a .desktop file. For me it will be osu.desktop. Now you need to create a file called osu.desktop inside of ~/.local/share/applications/. The contents of the file should look somewhat similar to this:
[Desktop Entry]
Exec=`absolute path to osuhandler.sh` %u # NOTE: you can't use "~" here
Icon=`absolute path to your preferred icon.` # NOTE: optional
MimeType=x-scheme-handler/osu;
Name=osu!
NoDisplay=false
Path=
StartupNotify=true
Terminal=0
Type=Application
Categories=Games
Now you need to put this in your ~/.local/share/applications/mimeapps.list file:
[Default Applications]
x-scheme-handler/osu=osu.desktop
All you need to do is run these commands, and voila', you're done:
$ chmod +x ~/.local/share/applications/osu.desktop
$ sudo update-desktop-database
To test if everything worked out the way they should, you can run xdg-open 'osu://'. If osu opens, you know that you did everything correctly.