简体   繁体   English

在遵守 FreeDesktop 标准的同时,在哪里为用户特定的应用程序安装图标?

[英]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.

相关问题 带有图标作为唯一用户界面的Android应用程序 - Android application with the icon as the only user interface 是否有图标图像的标准/最佳做法? 即“删除”,“刷新”等 - Are there standards / best practices for icon images? ie, “Delete”, “Refresh”, etc 在确定菜单项目的位置时是否有任何标准可供遵循? - Are there any standards to follow in determining where to place menu items? 为 pyqt5 应用程序在任务栏中设置与应用程序图标相同的图标 - Setting the Same Icon as Application Icon in Task bar for pyqt5 application Qt Gui应用程序图标设置 - Qt Gui Application icon setup 在托盘图标中运行应用程序(不在任务栏中) - Run Application in tray icon(not in taskbar) 如何确保我的用户界面符合MSAA标准? - How can I make sure my user interface adheres to MSAA standards? 如何构建可以在窗口之间拖放用户控件的 WPF 应用程序? - How do I build a WPF application where I can drag and drop a user control between windows? 我可以在表单应用程序的while循环中查询用户交互事件吗? - Can I query for user interaction events within a while loop, in a form application? node.js 应用程序中的系统托盘图标 - System tray icon in node.js application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM