Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
zh-cn:howto:customize-menu [2012/04/18 14:48] – [Customize the Xfce menu] haobug | zh-cn:howto:customize-menu [2012/04/18 16:10] – [Hide only root entries] haobug |
---|
此页介绍如何在4.5或更高版本 Xfdesktop 上自定义菜单。对于早期版本,您可以使用 libxfce4menu 的 GUI。 | 此页介绍如何在4.5或更高版本 Xfdesktop 上自定义菜单。对于早期版本,您可以使用 libxfce4menu 的 GUI。 |
| |
GNU 许可的 LXDE 的图形菜单编辑器 [[http://lxmed.sourceforge.net|LXMenuEditor]] ,从 Xfce 4.8.0和LXMenuEditor 20110523 起,它也也可以用于 XFCE 了。 | GNU 许可的 LXDE 的图形菜单编辑器 [[http://lxmed.sourceforge.net|LXMenuEditor]] ,从 Xfce 4.8.0和LXMenuEditor 20110523 起,它也可以用于 XFCE 了。 |
===== What xfdesktop installs ===== | ===== xfdesktop 会安装什么文件 ===== |
Xfdesktop installs a menu file and .desktop files which together with non-xfdesktop .desktop files define the menu. To customize your menu you need to modify them. The method described here modifies the menu file identified by the $XDG_CONFIG_HOME variable (usually null, so ~/.config/menus/xfce-applications.menu) and copies of .desktop files in your home directory. | Xfdesktop 会安装菜单文件和 .desktop 文件以及一些定义菜单的非 xfdesktop 的 .desktop 文件。自定义菜单就需要修改这些文件。这里描述修改的菜单文件由环境变量 $XDG_CONFIG_HOME 确定(通常为空,所以是 ~/.config/menus/xfce-applications.menu)和一些你的主目录中 .desktop 文件。 |
| |
===== When xfdesktop implements your changes ==== | ===== 你的修改什么时候生效 ==== |
If the menu file's directory exists when the xfdesktop session starts, changes to the menu file are implemented immediately. Similarly if the //.local/share/applications// directory in your home directory exists when the xfdesktop session starts, changes to its .desktop files are implemented immediately. | 当 xfdesktop 会话启动时,如果菜单文件的目录存在,修改立即生效。同样地,当 xfdesktop 会话启动时,如果你主目录中的 //.local/share/applications// 目录存在的话,对 .desktop 文件的修改也立即生效。 |
| ===== 复制菜单文件 ===== |
| |
===== Copy the menu file ===== | 只有你想要修改硬编码的项(通常在“设置”菜单以上,及最后一个子菜单以下)或者说你需要修改子菜单的定义时才需要这样做。 |
This is only necessary if you want to change the hardcoded entries (usually above the Settings sub-menu and below the last sub-menu) or to change the sub-menu definitions. | |
| 创建 ~/.config/menus 目录(如果还不存在): |
| |
Create ~/.config/menus directory (if it doesn't exist already): | |
mkdir ${XDG_CONFIG_HOME:-~/.config}/menus/ | mkdir ${XDG_CONFIG_HOME:-~/.config}/menus/ |
Copy the installed menu file to where xfdesktop will look for it before looking for the installed menu file ($prefix = /usr on most systems): | |
| 复制已安装的菜单文件到先于默认安装的菜单文件路径的 xfdesktop 查找的路径中(在大多数系统上 $prefix = /usr)。 |
cp $prefix/etc/xdg/menus/xfce-applications.menu ${XDG_CONFIG_HOME:-~/.config}/menus | cp $prefix/etc/xdg/menus/xfce-applications.menu ${XDG_CONFIG_HOME:-~/.config}/menus |
or | 或者 |
cp $prefix/etc/xfce/xdg/menus/xfce-applications.menu ${XDG_CONFIG_HOME:-~/.config}/menus | cp $prefix/etc/xfce/xdg/menus/xfce-applications.menu ${XDG_CONFIG_HOME:-~/.config}/menus |
| |
===== Copy a .desktop file ===== | ===== 复制 .desktop 文件 ===== |
For example, to copy the Web Browser's .desktop file to the //.local/share/applications// directory in your home directory ($prefix = /usr on most systems): | |
| 例如,要复制Web浏览器的 .desktop 文件到主目录中的 //.local/share/applications// 目录 |
| (在大多数系统上 $prefix = /usr): |
cp $prefix/share/applications/xfce4-web-browser.desktop ~/.local/share/applications | cp $prefix/share/applications/xfce4-web-browser.desktop ~/.local/share/applications |
or | 或者 |
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 ===== | ===== Add entries ===== |