-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
open links with this browser system-wide #7
Comments
I will try to do it for the version 0.8.7 :) |
Now it is possible to open links with WebPirate using the link that you have provided (https://together.jolla.com/question/1836/set-default-browser) I have investigated in order to open a new tab when the browser is already opened: the default browser creates a D-Bus service with an "openUrl" method (the name can be seen in open-url.desktop) I have managed to create a service for WebPirate too, and I have modified open-url.desktop so it points to the WebPirate's one, but it doesn't works (I don't know why), calling it manually, when the browser is opened, works correctly and opens a new tab with the requested url. I will close this issue when the browser can load links even if it is already opened. |
Is there any progresss on this? |
It's a Sailfish issue, I can't do anything atm. |
I have done the workaround, but it appears that there is another issue: If Webpirate is already open and there is only one tab (more not tested) and you click a link in another application WebPirate is opened, but nothing more happens. I think it should open a new tab including whatever link was clicked. I think this might be #7 (comment) in less technical words. |
It's a known issue, and it is related to the default browser issue in Sailfish. In order to open a new tab, WebPirate needs a DBus service, this one is present in the source code, but is disabled (and untested from about 10 releases) because it is not allowed in the harbour. |
I have news about this issue! The commit ce0bded restores DBus service and it's only running when WebPirate is active (it seems to be allowed in the harbour, because Tweetian does the same thing), but, now the problem is different: Case 1 (edit harbour-webpirate.desktop)
works as always: executing WebPirate instead of Sailfish Browser BUT it does not open new tabs. Case 2 (edit open-url.desktop)
If WebPirate is running it creates a new tab BUT when an external link is clicked from another application and the browser is NOT running, nothing happens. I have tried to do Case 1 + Case 2, but Saiflish fallbacks to Case 1. |
Is there something preventing the line in (Also what is the proper spelling for Web Pirate? I think I change how I spell/write/type it a lot.) |
Yes, it's about harbour restrictions!
It's ok "WebPirate" and "Web Pirate" too :D |
If this is fixed, feel free to close this issue. |
It's not, because that one line must always be uncommented after update (even if I am unsure can anything be done to it) and new tabs cannot be opened from external applications if Web Pirate is already open (it only opens Web Pirate with whatever tab you have active). |
I think the dbus solution works fine for WebPirate if it would have a "daemon" like dbus service running waiting in the background to start WebPirate even if the UI part is closed. |
I have to correct me there. Actually the booster-browser has nothing todo with the dbus calls. Its just a form of preloading the browser libraries for faster startup times. PS: So basically Method 1 and 2 can work together by adding that dbus service file and open-url.desktop then can look like this
P.P.S: I think I found another interesting thing. If I did nothing wrong you can also put the dbus service file in ~/.local/share/dbus-1/services . This would make it possible at least to add an option in the browser itself (under settings or somewhere) to make it the default. |
@llelectronics Thanks for the extra info!!! :) Writing the .service file in /.local/share/dbus-1/services overrides sailfish-browser settings too? And it is allowed, in the Harbour? |
The .service file does not need to override sailfish-browser settings. As for harbour. I don't think it can be shipped in the rpm directly as it would need to ship a hardcoded path /home/nemo which isn't allowed. |
Ok, now is crystal clear! Thanks for your research @llelectronics :) |
@llelectronics: The problem is: Jolla allows those type of "local" services? |
At least th harbour checker should not complain. In general maybe we could work out a standard somehow so that the mimer application will be able to set default apps (not only a webbrowser) with the dbus service file creation. |
It's ok for me. About the MIME, do you mean something like this? (thanks for the helper.cpp btw :) ) void DefaultBrowser::overwriteMime()
{
this->setBusy(true);
QString desktopfilename = QString("%1.desktop").arg(qApp->applicationName());
this->setMime("text/html", desktopfilename);
this->setMime("x-maemo-urischeme/http", desktopfilename);
this->setMime("x-maemo-urischeme/https", desktopfilename);
this->setBusy(false);
}
void DefaultBrowser::restoreMime()
{
this->setBusy(true);
this->setMime("text/html", "open-url.desktop");
this->setMime("x-maemo-urischeme/http", "open-url.desktop");
this->setMime("x-maemo-urischeme/https", "open-url.desktop");
this->setBusy(false);
}
void DefaultBrowser::setMime(const QString &mimetype, const QString &desktopfile) const
{
QDir localappsdir = this->localApplicationsDirectory();
if(!localappsdir.exists("defaults.list"))
{
QProcess symlink;
symlink.start(QString("ln -sf %1 %2").arg(localappsdir.absoluteFilePath("mimeapps.list"), localappsdir.absoluteFilePath("defaults.list")));
symlink.waitForFinished();
}
QProcess xdgmime;
xdgmime.start(QString("xdg-mime default %1 %2").arg(desktopfile, mimetype));
xdgmime.waitForFinished();
} |
Yeah exactly :) |
Ok, the commit 3590e31 uses xdg-mime. At the current state openUrl() DBus method is called correctly, but if I press a link when the browser is not started nothing happens. text/html, x-maemo-urischeme/http and x-maemo-urischeme/https MIME types are set to "open-url-webpirate.desktop" And openurl-webpirate.desktop contains:
The .service is in .local/share/dbus-1/service, and in .local/share/applications I have open-url-webpirate.desktop Am I missing something? |
The folder should be ~/.local/share/dbus-1/services though in your source I think it is correct. PS: OK small update. Its not a caching issue. I tested it on my device by removing the .local/share/dbus-1/services/ directory and it stopped working. So it has to be something else. PPS: Try perhaps editing the exec line in your service file to see if you can call harbour-webpirate directly without using the invoker. |
Ok fixed in 01b70a4 .service files are case sensitive :D |
Great!!! I'm testing v1.7-5 and it seems it's working fine ;) |
As already commented on openrepos.net, it would be great to have support for opening links using webpirate.
It worked using WebCat, by creating a file in /usr/share/applications/.
Links:
llelectronics/webcat#13
https://together.jolla.com/question/1836/set-default-browser/
The text was updated successfully, but these errors were encountered: