We have moved to a new Sailfish OS Forum. Please start new discussions there.
159

set default browser

asked 2013-12-25 22:39:30 +0200

ortylp gravatar image

updated 2019-10-04 21:31:02 +0200

raketti gravatar image

Option for setting default handler for URLs is needed. The builtin browser is not usable (yet?) and it would help a lot, if one could set e.g. firefox or opera as the default app opening an URL.

Edit 2019-10-04: So, now that we have a start with the mime-type handling (if multiple browsers are installed, one can select the preferred one). This feature request could be extended to provide the selection of Android apps (FF, Chrome, or what ever rocks your boat).

edit retag flag offensive close delete

3 Answers

Sort by » oldest newest most voted
35

answered 2013-12-30 00:21:23 +0200

Nux gravatar image

updated 2014-06-12 01:03:15 +0200

You can kind of hack into this if you have Developer mode on:

  1. Go to: /usr/share/applications.
  2. Open files: sailfish-browser.desktop(*) and your-favorite-browser.desktop.
  3. Copy "MimeType" property from "sailfish-browser.desktop" to "your-favorite-browser.desktop".
  4. Remove (or add hash) before "MimeType" property in "sailfish-browser.desktop".
  5. Save :-).
  6. Run this command: update-desktop-database (must be run as root!).

Done. The file /usr/share/applications/mimeinfo.cache should be updated after that.

(*) In more recent Jolla version you need to edit open-url.desktop instead of sailfish-browser.desktop.

For browsers working on Android you need to enable adb. Then your exec should contain something like: Exec=/opt/alien/system/bin/adb -e shell am start -a android.intent.action.VIEW -n package.name.of.you.favorite.android.browser/.BrowserActivity -d ' %U'. Note that the space before "%U" is crucial!

Example http handler file for Dolphin (create it in "/usr/share/applications/dolphin-open-handler.desktop"):

[Desktop Entry]
Exec=/opt/alien/system/bin/adb -e shell am start -a android.intent.action.VIEW -n mobi.mgeek.TunnyBrowser/.BrowserActivity -d ' %U'
Name=Dolphin HTTP handler (opener)
Type=Application
MimeType=text/html;x-maemo-urischeme/http;x-maemo-urischeme/https;
X-Nemo-Application-Type=no-invoker
X-Nemo-Single-Instance=no
X-apkd-apkfile=/data/app/mobi.mgeek.tunnybrowser.apk
NoDisplay=true

Oh and, to edit files in /usr/share/applications you either need to do it as root or use something like chmod a+w /usr/share/applications/*

Warning! A typo in a command that is run in terminal might brick your device. Use with care (when possible use copy&paste to e.g. PuTTy)!

Edit: Firefox example:

[Desktop Entry]
Exec=/opt/alien/system/bin/adb -e shell am start -a android.intent.action.VIEW -n org.mozilla.firefox/.App -d ' %U'
Name=Firefox HTTP handler (opener)
Type=Application
MimeType=text/html;x-maemo-urischeme/http;x-maemo-urischeme/https;
X-Nemo-Application-Type=no-invoker
X-Nemo-Single-Instance=no
X-apkd-apkfile=/data/app/org.mozilla.firefox.apk
NoDisplay=true
edit flag offensive delete publish link more

Comments

This works, but reveals warnings to the effect of 'the use of "x-maemo-urischeme" as media type is strongly discouraged in favor of a subtype of the "application" media type'. Also webcat doesn't seem to support URL arguments as of yet.

jsiren ( 2014-01-14 20:21:26 +0200 )edit
2

Seem to already be done in the source. So I'm guessing it will be available in the next release.

Nux ( 2014-01-14 21:44:40 +0200 )edit

Just a little notice - update doesn't remove the custom desktop files but restores "sailfish-browser.desktop". So just remove MimeType again and run update-desktop-database.

Nux ( 2014-02-04 01:10:22 +0200 )edit

it works but the web page linked is not opening.. just the homepage is shown

Ghost ( 2014-10-20 23:27:24 +0200 )edit
1

Just a small addition as I was asked for it on TMO. To use WebCat as default browser either creathe a new .desktop file or replace open-url.desktop with:

[Desktop Entry]
Type=Application
Name=Browser
NotShowIn=X-MeeGo;
MimeType=text/html;x-maemo-urischeme/http;x-maemo-urischeme/https;
Exec=/usr/bin/harbour-webcat '%U'
leszek ( 2014-11-24 22:34:45 +0200 )edit
16

answered 2014-08-06 23:43:40 +0200

MarcG gravatar image

I was asking a similar question a few days ago. "Can it be make possible to select the browser in the applications settings?" Lets hope that this wil be available in the next update. The above noted solution is to complicated for normal users.

edit flag offensive delete publish link more

Comments

1

Agreed, it's more of a hack than an actual solution, and apparently it's not quite possible to have an app that does that, since it requires root access. We can only hope that Jolla will deliver a real solution in the next update.

tadzik ( 2014-08-07 11:45:31 +0200 )edit
3

Yep, it should be a simple 'select your default browser' setting, I don't dare to mess with MyPrecious...

MikaN ( 2014-08-07 17:22:43 +0200 )edit
1

Normally it shouldn't require root access as it is using the normal mimetypes xdg configuration also used by linux desktop systems. So you can create a mimecache.info file manually just like the one in /usr/share/applications/ and configure the different file associations there. Maybe I will write a little app for this if I find time.

leszek ( 2014-11-25 14:13:30 +0200 )edit
13

answered 2015-10-06 20:16:22 +0200

leszek gravatar image

Mimer a graphical mimetype configuration tool for the basic apps is now available here: https://openrepos.net/content/llelectronics/mimer

It has still some limitations as not being able to set an android app as default. The reason for this is there is no easy way (despite the adb enabling shell trick from above) to launch android applications with parameters. Also dbus service files (necessary for example to launch a new tab in an already opened browser) are not available yet in this application. There seems to be a lack of standards for this to integrate into mimer.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
33 followers

Stats

Asked: 2013-12-25 22:39:30 +0200

Seen: 8,919 times

Last updated: Oct 04 '19