forum

How to Open Links in Osu on Linux

posted
Total Posts
5
Topic Starter
MrLinuxFish
After much difficulty getting osu to open links correctly and accept links to beatmaps, I give you the guide to getting links in osu working correctly.

These steps should work to make user profile links and such from within osu open in your default Linux browser instead of Internet Explorer through wine as well as passing osu direct links and beatmap mods to osu.

There is quite a bit of information in this post, so I have put the steps for both parts (opening links from osu and opening links in osu) in boxes.

Opening links from osu in your default browser on Linux:
SPOILER
This requires some wine regedit changes:

Run the command "wine regedit" (you may have to specify the wine prefix you run osu in)

HKEY_CURRENT_USER -> Software -> Wine -> WineBrowser (this likely doesn't exist yet on your system)
Add a string value : "Browsers" with value "xdg-open"

HKEY_CLASSES_ROOT -> http -> shell -> open -> command
Edit the (Default) string value to "C:\windows\system32\winebrowser.exe -nohome "%1"" (note the "%1" has quotation marks around it)

HKEY_CLASSES_ROOT -> https -> shell -> open -> command
This will be set the same as the previous key "C:\windows\system32\winebrowser.exe -nohome "%1""

These changes will open links in your default browser in Linux

At this point you should be able to open links such as user profiles from osu in your linux browser

Opening URI links in osu (links in the form osu://*):
SPOILER
To open links in osu you will need to associate the mime type for osu URIs this can be done by editing your ~/.local/share/applications/mimeapps.list
These are the lines we are interested in, later we will create a few files for these mime associations:
"
[Default Applications]
x-scheme-handler/osu=osuhandler.desktop

[Added Associations]
x-scheme-handler/osu=osuhandler.desktop
"


Once you have these lines in your mimeapps.list, you will need to create a file ~/.local/share/applications/osuhandler.desktop:
"
[Desktop Entry]
Comment[en_US]=
Exec=/home/atomsk/.osu/osuhandler.sh %u
GenericName[en_US]=Osu URI Handler
Icon=/home/atomsk/Downloads/Logo.png
MimeType=
Name[en_US]=Osu! URI Handler
Name=Osu!
NoDisplay=false
Path[$e]=
StartupNotify=true
Terminal=0
Type=Application
"


You will need to change the location of your osu install on the line "Exec" This links to a script which will pass the URI to osu. (Note the %u at the end. This is necessary to pass the URI to the script we will create later)

On to the script where all the magic happens (I put mine at ~/.osu/osuhandler.sh, but it can be anywhere so long as the path is defined in the .desktop file correctly)
"
#!/bin/bash

#echo passed arguments to log
echo $@ >> /home/atomsk/.osu/handler.log

#Execute osu!\.exe in correct wine prefix and append uri
#$@ is the variable which stores all passed arguments
WINEPREFIX=~/.osu wine ~/osu\!/osu\!.exe $@
"


The line with the WINEPREFIX executes the osu.exe and then has an $@ to pass the URI to osu

I also created a log of arguments passed to the handler using "touch ~/.osu/handler.log"

The last step is to rebuild your mime cache so your OS knows what to do with the osu URIs
"sudo update-desktop-database"

Now, you should be able to open up osu direct links as well as beatmap mods
irrlux
Thanks a lot, now it's working for me, too.
Topic Starter
MrLinuxFish
No problem. 8-) Now to get osu to open links to beatmaps from the browser
JohnnyKnoxville
Great tutorial! Thanks :)
Biri-Biri
It doesn't work for me anymore. Does it for anyone of you guys?
Please sign in to reply.

New reply