Adamcake / Bolt

An alternative launcher for your favourite MMO
GNU Affero General Public License v3.0
162 stars 23 forks source link

RuneLite launched through Bolt opens Chromium instead of respecting xdg-settings #21

Closed dennismaloney closed 7 months ago

dennismaloney commented 7 months ago

When using RuneLite launched through Bolt, but not through the Jagex Launcher, any action that opens a web browser (such as using the wiki button) opens a new Chromium window. But in xdg-settings, default-web-browser is set to firefox.desktop.

Adamcake commented 7 months ago

Looks like RuneLite uses xdg-open for that. https://github.com/runelite/runelite/blob/master/runelite-client/src/main/java/net/runelite/client/util/LinkBrowser.java#L63

What does it say in RuneLite's console output when you open a website? Do you get this message about xdg-open? Maybe it's failing and defaulting to the other method?

Adamcake commented 7 months ago

I'm assuming you installed from Flatpak as this will almost 100% be a Flatpak sandboxing issue rather than something directly related to Bolt. It seems like the sandbox doesn't even mount xdg-settings to begin with. It does mount xdg-open, but maybe the decision of what browser to use will be different somehow.

dennismaloney commented 7 months ago

I don't see any console messages generated at the time of opening a website, although if there's a way to get more verbose output than just running from the command line, I haven't tried that.

I installed from the AUR.

dennismaloney commented 7 months ago

Okay, running with debug enabled, I get a message like this: 2024-02-07 09:53:31 EST [Thread-13] DEBUG net.runelite.client.util.LinkBrowser - Opened url through xdg-open to https://oldschool.runescape.wiki/w/Special:Lookup?type=item&id=12926&name=Toxic%20blowpipe&utm_source=runelite

Adamcake commented 7 months ago

Then, as you can see from its source code, RuneLite is quite simply spawning a process xdg-open <your url>, and waiting for it to finish. If you type xdg-open https://oldschool.runescape.wiki/w/Special:Lookup?type=item&id=12926&name=Toxic%20blowpipe&utm_source=runelite into a command line, which browser does that open?

dennismaloney commented 7 months ago

Running xdg-open from the command line opens Firefox, in line with xdg-settings. There's another weird little detail in that Chromium complains about not being the default browser after being opened, so it evidently sees the same xdg-settings that I do.

Adamcake commented 7 months ago

Ah, it could be because you don't have any XDG environment variables set? Particularly XDG_DATA_HOME and XDG_CONFIG_HOME?

dennismaloney commented 7 months ago

Yes, that does seem to be the problem, thank you! I'll have to see if setting them after they've been unset for so long screws with anything else, but that seems to be out of scope here.