桌面菜单、.desktop 文件和 xdg-desktop-menu
/usr/share/applications 中的 .desktop 文件、xdg-desktop-menu 命令和 update-desktop-database 命令之间有什么关系?
我正在尝试制作一个为我的应用程序创建桌面图标的 RPM。在 RPM 中,我将供应商应用程序名称.desktop 文件安装到 /usr/share/applications 中。然后我有以下安装后脚本:
if [ -x "`which xdg-desktop-menu 2>/dev/null`" ]; then
xdg-desktop-menu install $RPM_BUILD_ROOT/usr/share/applications/vendor-myapp.desktop
fi
if [ -x "`which update-desktop-database 2>/dev/null`" ]; then
update-desktop-database &> /dev/null || :
fi
并且未创建图标。 运行该命令,则会创建该图标
xdg-desktop-menu install $RPM_BUILD_ROOT/usr/share/applications/vendor-myapp.desktop
如果我稍后以非 root 身份手动 。如果我以 root 身份执行此操作(据说 RPM 就是这样做的),则不会创建图标。另外,我非常怀疑 if[] 位下的 update-desktop-database
未执行。当我手动运行整个 if[]
语句时,它会被执行。
Fedora Linux 与 Gnome。
What's the relationship between .desktop files in the /usr/share/applications, the xdg-desktop-menu command and update-desktop-database command?
I'm trying to make a RPM that creates a desktop icon for my app. In the RPM, I install the vendor-appname.desktop file into /usr/share/applications. Then I have the following post-install script:
if [ -x "`which xdg-desktop-menu 2>/dev/null`" ]; then
xdg-desktop-menu install $RPM_BUILD_ROOT/usr/share/applications/vendor-myapp.desktop
fi
if [ -x "`which update-desktop-database 2>/dev/null`" ]; then
update-desktop-database &> /dev/null || :
fi
And the icon is not created. The icon IS created if I run the
xdg-desktop-menu install $RPM_BUILD_ROOT/usr/share/applications/vendor-myapp.desktop
command manually later on, as a non-root. If I do so as a root (which is, supposedly, how the RPM does it), the icon is not created. Also, I have a very strong suspicion that the update-desktop-database
under if[] bit is not executed. It is executed when I manually run the whole if[]
statement.
Fedora Linux with Gnome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Fedora 上,请确保:
然后(%{SOURCE1} 是您的桌面文件):
如果您安装自己的图标,您还需要更新图标缓存,在相关规范文件部分中添加:
参考:
http://fedoraproject.org/wiki/PackagingGuidelines#Desktop_files
http://freedesktop.org/wiki/Software/desktop-file-utils
http://fedoraproject.org/wiki/Packaging/ScriptletSnippets#Icon_Cache
On Fedora, be sure of:
Then (%{SOURCE1} is your desktop file):
If you install your own icon, you also need to update the icon cache, adding in the relative specfile sections:
Refs:
http://fedoraproject.org/wiki/PackagingGuidelines#Desktop_files
http://freedesktop.org/wiki/Software/desktop-file-utils
http://fedoraproject.org/wiki/Packaging/ScriptletSnippets#Icon_Cache