[英]Where to install icon for a user-specific application while adhering to FreeDesktop standards?
I have a GUI application that I want to install per-user in a FreeDesktop-compliant manner.我有一个 GUI 应用程序,我想以符合 FreeDesktop 的方式为每个用户安装它。 Reading the relevant specifications, it seem that a '.desktop' file should be placed in ~/.local/share/applications
, and that it should contain an Icon
key set to the name of the icon without extensions.阅读相关规范,似乎应该将“.desktop”文件放在~/.local/share/applications
中,并且它应该包含一个Icon
键,该键设置为不带扩展名的图标名称。
The issue I'm facing is that I can't find per-user location where I should store the icon.我面临的问题是我找不到每个用户应该存储图标的位置。 TheIcon Theme specification state that application icons should at least be stored in $prefix/share/icons/hicolor/48x48/apps
, but it never defines what values $prefix
takes. 图标主题规范state 应用程序图标至少应存储在$prefix/share/icons/hicolor/48x48/apps
中,但它从未定义$prefix
采用的值。 It mentions $HOME/.icons
but depricates it as legacy.它提到$HOME/.icons
但将其贬低为遗产。 All other paths I found were system-wide.我发现的所有其他路径都是系统范围的。
Gnome's Integration Guide specifies that icons should be stored in /usr/share/icons/hicolor/48x48/apps/
but makes no mention of per-user installation despite alluding to per-user installations elsewhere in the guide. Gnome 的集成指南指定图标应存储在/usr/share/icons/hicolor/48x48/apps/
中,但没有提及按用户安装,尽管在指南的其他地方提到了按用户安装。
Given that what I managed to find does not provide me with the information I want, I ask this:鉴于我设法找到的内容没有为我提供我想要的信息,我问这个:
Where should a place my application's icon so that xdg desktops can find them?我的应用程序图标应该放在哪里,以便 xdg 桌面可以找到它们?
Kindly note that I am aware of kde4-config --path icon
and friends.请注意,我知道kde4-config --path icon
和朋友。 I want to avoid handling icons for every desktop I want to support if possible.如果可能,我想避免处理我想要支持的每个桌面的图标。
Rereading the XDG Icon Specification, I noticed the specification references the XDG Base Directory Specification by including $XDG_DATA_DIRS
.重读 XDG 图标规范,我注意到规范通过包含$XDG_DATA_DIRS
来引用XDG 基本目录规范。 This inclusion implies that that the Base Directory Specification is also in effect, which in turn mandates that这种包含意味着基本目录规范也有效,这反过来又要求
Lookups of the data file should search for./subdir/filename relative to all base directories specified by $XDG_DATA_HOME and $XDG_DATA_DIRS.数据文件的查找应搜索相对于 $XDG_DATA_HOME 和 $XDG_DATA_DIRS 指定的所有基本目录的 ./subdir/filename。 If an environment variable is either not set or empty, its default value as defined by this specification should be used instead.如果环境变量未设置或为空,则应使用本规范定义的默认值。 (src) (源)
So, assuming my understanding is correct and XDG desktops adhere to specs, the user-specific icon location for your application is $XDG_DATA_HOME/icons/hicolor/48x48/apps/$YOURAPP.(png|xpm)
and $XDG_DATA_HOME/icons/hicolor/scalable/apps/$YOURAPP.svg
.因此,假设我的理解是正确的并且 XDG 桌面符合规范,那么您的应用程序的用户特定图标位置是$XDG_DATA_HOME/icons/hicolor/48x48/apps/$YOURAPP.(png|xpm)
和$XDG_DATA_HOME/icons/hicolor/scalable/apps/$YOURAPP.svg
。 File extensions are case-sensitive and only these three extensions are allowed.文件扩展名区分大小写,只允许使用这三个扩展名。 Also note that SVG support is optional.另请注意,SVG 支持是可选的。
If $XDG_DATA_HOME
is not set, you should default to $HOME/.local/share
as per the Base Directory Specification.如果未设置$XDG_DATA_HOME
,则应根据基本目录规范默认为$HOME/.local/share
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.