Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
zh-cn:howto:customize-menu [2012/04/18 15:55] – [复制菜单文件] haobug | zh-cn:howto:customize-menu [2012/04/18 16:32] – [添加菜单项] haobug |
---|
===== 复制菜单文件 ===== | ===== 复制菜单文件 ===== |
| |
只有你想要修改硬编码项(通常在“设置”菜单以上,及最后一个子菜单以下)或者说你需要修改子菜单的定义时才需要这样做。 | 只有你想要修改硬编码的项(通常在“设置”菜单以上,及最后一个子菜单以下)或者说你需要修改子菜单的定义时才需要这样做。 |
| |
创建 ~/.config/menus 目录(如果还不存在): | 创建 ~/.config/menus 目录(如果还不存在): |
或者 | 或者 |
cp /usr/share/applications/xfce4-web-browser.desktop ~/.local/share/applications | cp /usr/share/applications/xfce4-web-browser.desktop ~/.local/share/applications |
===== Hide menu entries ===== | ===== 隐藏菜单项 ===== |
If you want to hide menu entries from all menus, copy their .desktop files and edit them to add a ''NoDisplay=true'' line. | |
| 如果你想隐藏菜单项,复制他的 .desktop 文件,编辑并添加一行 ''NoDisplay=true'' 。 |
| |
>> {{wiki:warning.png}} | >> {{wiki:warning.png}} |
>> As explained[[http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html|here]], ''NoDisplay=true'' will hide the application from the menu but the mime type associations will still be available. ''Hidden=true'' is equivalent to deleting the file. | >> 如[[http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html|这]]的解释,''NoDisplay=true'' 会在菜单上隐藏程序,但 mime 类型的关联仍然存在。''Hidden=true'' 等价于删除这个文件。 |
| |
| ===== 只隐藏根菜单项 ===== |
| |
===== Hide only root entries ===== | 如果你只想删除根菜单项,复制它们的 .desktop 文件,编辑并删除 X-Xfce-Toplevel Category。 |
If you only want to remove menu items from the root menu only, copy their .desktop files and edit them to remove Category X-Xfce-Toplevel. | |
| |
Xfdesktop installs the following desktop entry files in the root menu ($prefix = /usr on most systems): | Xfdesktop 默认会安装下面这些根菜单项(在大多数系统上 $prefix = /usr): |
| |
* ''$prefix/share/applications/xfce4-about-xfce.desktop'' | * ''$prefix/share/applications/xfce4-about-xfce.desktop'' |
* ''$prefix/share/applications/xfce4-web-browser.desktop'' | * ''$prefix/share/applications/xfce4-web-browser.desktop'' |
| |
For example, to remove Web Browser from the root menu, copy its .desktop file and edit it, changing ''Categories=X-XFCE;X-Xfce-Toplevel;'' to ''Categories=X-XFCE;'' | 例如,把Web浏览器从根菜单中删除,复制它的 .desktop 文件,编辑并修改 ''Categories=X-XFCE;X-Xfce-Toplevel;'' 为 ''Categories=X-XFCE;'' |
| |
===== Add entries ===== | ===== 添加菜单项 ===== |
Create a .desktop file for each entry required. For example, a menu entry for Eclipse, create a file named ''eclipse.desktop'' in ''~/.local/share/applications'': | |
| 为每个菜单项创建一个 .desktop。例如,一个 Eclipse 的菜单项,在 ''~/.local/share/applications''中创建文件 ''eclipse.desktop'': |
[Desktop Entry] | [Desktop Entry] |
Version=1.0 | Version=1.0 |
Name=Eclipse | Name=Eclipse |
Comment=Eclipse Java IDE | Comment=Eclipse Java IDE |
If you prefer to work in a GUI (allows browsing for the icon) you can create the .desktop file using | |
| 如果你喜欢用 GUI 工具(可以浏览选择图标),你可以用下面的命令创建 .desktop 文件 |
exo-desktop-item-edit --create-new ~/.local/share/applications | exo-desktop-item-edit --create-new ~/.local/share/applications |
but the new file will only have category Application so will probably need editing afterwards. | |
| |
The categories determine where the new entry will be displayed. For display in the root menu, include category X-Xfce-Toplevel. For display in a sub-menu, include at least one of the categories defined for that sub-menu. These can be found by examining your ''${XDG_CONFIG_HOME:-~/.config}/menus/xfce-applications.menu''. For example here's an Accessories sub-menu definition: | 但这样新建的文件类别(Category)里面只有 Application, 可能需要再编辑才行。 |
| |
| 类别(Category)决定菜单项会显示在哪。要在根菜单中显示,添加 X-Xfce-Toplevel 类别。要在子菜单中显示,添加至少一个已定义的子菜单类别。这个可以在 ''${XDG_CONFIG_HOME:-~/.config}/menus/xfce-applications.menu'' 文件中找到。例如这是一个“附件”菜单的定义: |
<code xml> | <code xml> |
<Menu> | <Menu> |
</Menu> | </Menu> |
</code> | </code> |
Any .desktop files with categories including Accessibility, Core, Legacy or Utility will be shown in the Accessories sub-menu providing they do not also have ''NoDisplay=true''. | |
| 任何包含 Accessibility, Core, Legacy 及 Utility 类别的并没有 ''NoDisplay=true'' 的 .desktop 文件都会显示在“附件”菜单下。 |
| |
===== The Other sub-menu ===== | ===== The Other sub-menu ===== |