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
appstream:/id URL handler #11
Labels
Comments
|
This simple patch does the trick in Discover. diff --git a/discover/main.cpp b/discover/main.cpp
index 66ba5a7..21bf164 100644
--- a/discover/main.cpp
+++ b/discover/main.cpp
@@ -50,6 +50,7 @@ int main(int argc, char** argv)
parser.addOption(QCommandLineOption("category", i18n("Display a list of entries with a category."), "name"));
parser.addOption(QCommandLineOption("mode", i18n("Open Muon Discover in a said mode. Modes correspond to the toolbar buttons."), "name"));
parser.addOption(QCommandLineOption("listmodes", i18n("List all the available modes.")));
+ parser.addPositionalArgument("urls", i18n("Supports appstream: url scheme"));
MuonBackendsFactory::setupCommandLine(&parser);
about.setupCommandLine(&parser);parser.addHelpOption();
parser.addVersionOption();
@@ -74,6 +75,13 @@ int main(int argc, char** argv)
fprintf(stdout, " * %s\n", qPrintable(mode));
return 0;
}
+
+ foreach(const QString &arg, parser.positionalArguments()) {
+ QUrl url(arg);
+ if (url.scheme() == QLatin1String("appstream")) {
+ mainWindow->openApplication(url.path());
+ }
+ }
}
mainWindow->show();
diff --git a/discover/org.kde.discover.desktop b/discover/org.kde.discover.desktop
index d540f1b..be9128d 100644
--- a/discover/org.kde.discover.desktop
+++ b/discover/org.kde.discover.desktop
@@ -44,7 +44,8 @@ Name[uk]=Шукач Muon
Name[x-test]=xxMuon Discoverxx
Name[zh_CN]=Muon 发现者
Name[zh_TW]=Muon 探詢器
-Exec=muon-discover
+MimeType=x-scheme-handler/appstream
+Exec=muon-discover %U
Icon=muondiscover
Type=Application
X-DocPath=muon/index.html |
|
Will be in the next release, as discussed on IRC :-) |
|
KDE Discover and GNOME-Software support this feature now :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be really useful to have such a URL handler so that if the user clicks a URL with "appstream:" scheme, he launches Discover/Gnome-Software/Whatever.
This could help a lot minimize the access barrier to the projects we offer since we'd be leveraging a cross-distro naming scheme, therefore not compromising when giving a package name (like it used to be done with apt:/).
The text was updated successfully, but these errors were encountered: