我想问一个问题,但我会先拿出我的文件
<html>
<body>
<a href="cloudje:firefox">Open firefox</a>
</body>
</html>我的.desktop文件:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=/usr/bin/cloudjerun -c gedit
Name[en_US]=Gedit
Comment[en_US]=Small, easy-to-use program to access iTunesU media
Name=TunesViewer
Comment=Small, easy-to-use program to access iTunesU media
Icon=/usr/share/icons/hicolor/scalable/apps/tunesview.svg
Categories=Application;Network;
MimeType=x-scheme-handler/cloudje;
Comment[en_US.utf8]=Small, easy-to-use program to access iTunesU media教程:http://jarrpa.net/2011/10/28/creating-custom-url-handlers-in-ubuntu-11-04-11-10-gnome-3-0/
好吧,这很酷。.desktop文件将放置在/usr/share/application中。如果您执行命令'xdg-open cloudje:firefox‘或类似于'xdg-open cloudje:样例’的命令,它总是使用一个名为'cloudjerun‘的Python脚本来执行gedit。如何使用命令'xdg-open cloudje: firefox‘执行firefox?
我是否需要将‘Exec=/usr/bin/ -c gedit’替换为'Exec=/usr/bin/cloudjerun -c %U‘或'Exec=/usr/bin/cloudjerun -c %s’?
发布于 2013-11-23 14:21:49
在桌面文件中,Exec可以使用下列参数。
Add... Accepts...
%f a single filename.
%F multiple filenames.
%u a single URL.
%U multiple URLs.
%d a single directory. Used in conjunction with %f to locate a file.
%D multiple directories. Used in conjunction with %F to locate files.
%n a single filename without a path.
%N multiple filenames without paths.
%k a URI or local filename of the location of the desktop file.
%v the name of the Device entry.因此,在您的情况下,您可以调整您的Exec条目,如下所示:
Exec=/usr/bin/cloudjerun -c %u注意,尽管%u是完整的uri,因此,例如,当您运行xdg-open :Firefox %u将是我认为最简单的方法是调整cloudjerun脚本,在运行它之前删除uri的第一部分。
发布于 2018-07-07 20:51:51
这也许能帮上忙
(它是一个易于创建自定义协议处理程序的程序)
(您需要安装kde(应用程序或kde),然后运行它,还需要在终端中运行。
另外,您必须将root(sudo ~/Downloads/ProtocolCreator.sh))运行为,必须以的形式运行
它将在您的主目录中创建一个带有协议处理程序名称的文件夹(如https :中的https)。使用$1获取完整的url。没有什么简单的方法可以让它成为[something]:之后的角色.
修改文件夹中的文件,使其包含所需的所有内容。
现在,如果您想打开火狐,请使用<a href="blablabla:firefox">Open Firefox</a>,而文件夹中的文件包含以下内容:
#!/bin/bash
firefox
现在,当点击链接时,Firefox应该打开!
https://stackoverflow.com/questions/16376429
复制相似问题