使用Ubuntu OS上的URL dispatcher来启动其它的应用

96 阅读1分钟

URL dispatcher 是在Ubuntu OS上的一个服务。它可以让我们的应用(confined,i.e, click package应用)来启动其它的应用。这些应用通常是一个特别的URL来

识别的。可能最常见的例子就是向网页浏览器发送http:// URL来启动网页浏览器,但是像music或其它的应用也可以支持。对于大多数的应用来说,这是一个最游泳

的方式来退出现有的应用来启动另外一个应用。

 

对于Qt应用来说,它访问URL dispatcher的方法是通过Qt的desktop plugin。C++应用可以通过使用QDesktopServices.openURL()方法。QML应用可以使

用 Qt.openUrlExternally(string)方法。对于其它的应用来说,它们可以利用根据自己的需求使用Platform API或直接使用liburl-dispatcher。

 

URL dispatcher项目可以在Launchpad的链接找到。

 

支持的URL格式

 

基本URL格式

 

在URL dispatcher中有几种被支持的格式:

 

URLDescription
application:///$(app_id).desktopThe application URL can be used to start an application with a known Application ID. For applications that install their desktop file in /usr/share/applications the application ID should just be the name of the desktop file.
appid://(pkg)/(pkg)/(app)/$(version)Allows for launching an application using an application ID. Also provides for wild cards. The (app)canbe firstlisted, lastlistedapp or onlylistedapptoselecttheappropriateapplicaitonusingtheclickmanifest.Alsothe(app) can be first-listed, last-listed-app or only-listed-appto select the appropriate applicaiton using the click manifest. Also the (version) can be current-user-version to select the version in the manifest