Feature - Implemented 'Default' browser launch in Linux

NardoLoopa

Member
For those of us who take advantage of Mafia's cross-platform nature by using it on a USB drive between computers with differing OSs, it would be nice if the browser launch behavior could be changed when on Linux.

Currently, you can set the browser Mafia launches inside of Mafia on the Browser Settings tab, but that would dictate that browser for Windows and Linux. Instead, it would be nice if Mafia used a system resource on Linux to pick up it's 'default browser' of choice.

There are two good options here, I believe:
The first one is from X as altered by the command:

update-alternatives --config x-www-browser


The second might be easier in the form of the Java Control Panel ("/usr/bin/ControlPanel") where you can set the "Java Default Browser Launch" in the Advanced tab. I believe this sets:

deployment.browser.path

as seen in ~/.java/deployment/deployment.properties

Specifically, I'd like to use Chrome on Linux and Firefox on Windows.

Or if there is another environment variable that's used, please let me know.

Thanks.
 

Winterbay

Active member
Couldn't you just leave that setting in Mafia blank to bring up the default browser of the system and then set the different systems default browser to what you want it to be? Or am I missing something?
 

Theraze

Active member
Am I mistaken, or would that this feature update the default browser outside of mafia as well? That seems like potentially malicious behaviour... I tend to try to avoid programs that messily trail their settings throughout the system...
 

NardoLoopa

Member
Couldn't you just leave that setting in Mafia blank to bring up the default browser of the system and then set the different systems default browser to what you want it to be? Or am I missing something?

In fact, that was the route I originally took. But first, in Linux the "default browser" depends on which graphics libraries you are using at the time. X (mentioned above), Qt, Gnome and Java (mentioned above) all have different "defaults". None of these have any affect on Mafia's choice of browser in Linux. Instead it use some property called "os.browser". If someone could let me know where to set that, it would be helpful, and possibly resolve this issue.
 

NardoLoopa

Member
Am I mistaken, or would that this feature update the default browser outside of mafia as well? That seems like potentially malicious behaviour... I tend to try to avoid programs that messily trail their settings throughout the system...

I'm not requesting that mafia set the default browser for the system, but it leverage the system's current default.
 

Theraze

Active member
So, to clarify...
verb /ˈlev(ə)rij/  /ˈlēv(ə)rij/ 
leveraged, past participle; leveraged, past tense; leverages, 3rd person singular present; leveraging, present participle

Use borrowed capital for (an investment), expecting the profits made to be greater than the interest payable
- a leveraged takeover bid

Use (something) to maximum advantage
- the organization needs to leverage its key resources
Assuming you mean the second example, you're asking for mafia to USE the current default browser which it doesn't currently use? Mafia not using the default browser would be a bug, not a feature...
 

fronobulax

Developer
Staff member
KoLmafia uses the mafia preference preferredWebBrowser and the Java system property os.browser and it will set the latter under some circumstances. When a thumb drive is used to run mafia and mafia is run on both Windows and Linux systems the same setting is used for both operating systems (which should be expected). So part of this Feature Request is really to allow different settings for preferredWebBrowser based upon OS. Given that, the remainder of the discussion seems to be about ways to override or set preferredWebBrowser that are OS specific. Right?

If preferredWebBrowser=Chrome and preferredWebBrowser=Firefox work as expected on the respective systems (with full path and file names provided, of course) then why not just provide a new preference preferredWebBrowserNix? If the preference exists, is set and the user is on a *nix system then it would be used instead of preferredWebBrowser.

Alternatively, wanting to use different browsers on different OSes may be enough of an edge case to not warrant implementation.
 

NardoLoopa

Member
It's possible that this feature request could accurately be described as a bug, but Linux's concept of "default browser" is so suspect I didn't think it warranted that designation.

@fronobulax - if preferredWebBrowser is left blank Mafia will launch the Windows default browser on that OS. Implementing that same functionality on Linux would be the most desired case. The proliferation of preferredWebBrowser options based on the available OSes out there might be technically less challenging, but wouldn't be as desirable from a design or user standpoint (IMO).
 

fronobulax

Developer
Staff member
@fronobulax - if preferredWebBrowser is left blank Mafia will launch the Windows default browser on that OS. Implementing that same functionality on Linux would be the most desired case.

I'm confused or maybe I didn't look at the code carefully enough.

The very concept of "the Windows default browser" boggles my mind when running on *nix. That's why I very deliberately used the names of the preferences.

If you are running on *nix and preferredWebBrowser is 'empty' then what happens? Does a browser get launched or not? If one does get launched, which one and where was that choice/decision made? How does that relate to "Windows default browser"?

Not trying to be obtuse...

Thanks.
 

NardoLoopa

Member
I'm confused or maybe I didn't look at the code carefully enough.

The very concept of "the Windows default browser" boggles my mind when running on *nix. That's why I very deliberately used the names of the preferences.

If you are running on *nix and preferredWebBrowser is 'empty' then what happens? Does a browser get launched or not? If one does get launched, which one and where was that choice/decision made? How does that relate to "Windows default browser"?

Not trying to be obtuse...

Thanks.

On Linux mafia launches Firefox on my system. Probably due to this:
Code:
String[] browsers = { "seamonkey", "firefox", "mozilla", "opera", "konqueror", "netscape" };

as illustrated on line 955: http://kolmafia.svn.sourceforge.net...rowserLauncher.java?revision=9689&view=markup

At least that's assuming I'm navigating the switch() statements correctly.

And yes, as I mentioned in my second post, the idea of a "windows default" (where windows means any of the available 'windowing' UI environments available on Linux (Gnome, KDE, fluxbox, etc)) is a bit of a mess on Linux. Obviously using the Windows(tm) default browser in Linux is a daft idea. That's why I was suggesting X or Java as the source for discerning the browser to launch.
 

fronobulax

Developer
Staff member
On Linux mafia launches Firefox on my system. Probably due to this:
Code:
String[] browsers = { "seamonkey", "firefox", "mozilla", "opera", "konqueror", "netscape" };

Thanks. I was walking through the code and missed that somehow. Like I said, confused.

I wonder how many *nix users there are? Just adding Chrome to the list before Firefox seems like it would give you what you want, even if it is not a particularly elegant solution, but it will upset anyone else who is implicitly relying on that order.
 

holatuwol

Developer
xdg-open should open a preferred application (or at least it does on Xubuntu 11.10), so we'll see if 10050 handles what people want.
 
Last edited:
10051 opens konqueror instead of firefox for me while firefox is set as default browser (it thinks that it's default; /usr/bin/ControlPanel shows it as default and it's also default for *.html local files).
Mint 9/Ubuntu 10.04; LXDE;
10049 worked fine :(

UPDATE: setting firefox as default browser via update-alternatives --config x-www-browser worked for me.
---
NightBird
 
Last edited:
Top