Edit and configure CentOS desktop menus
Related configuration files:
*. Desktop file in the/usr/share/applications directory
Related directories:
$ HOME/. config/menus
/Etc/xdg/menus
/Usr/share/desktop-directories
After modification, you generally need to update the database:
Updatedb, update-desktop-database
The update-desktop-database and update-desktop-* programs are located in the xdg-utils package.
Bytes --------------------------------------------------------------------------------------------------------------------------
The qt4-qtconfig is located in System-Administration and now you want to change it to the Applications --> Programming menu:
Change (vim/usr/share/applications/qt4-qtconfig.desktop)
Categories = Qt; Settings; Is Categories = Qt; Development;
Why not Categories = Qt; Programming?
Switch to the/usr/share/desktop-directories directory:
[Root @ localhost desktop-directories] # grep Programming *
Development. directory: Name = Programming
Development. directory: Name [en_CA] = Programming
Development. directory: Name [en_GB] = Programming
Development-More.directory: Name = More Programming Tools
Development-More.directory: Name [en_GB] = More Programming Tools
Open the Development. directory file, starting
[Desktop Entry]
Name = Programming
....................
Description: Categories = Development corresponds to the Programming menu directory in the menu.
Finally, Categories = Qt; Development; can also be written as Categories = Development;
To add a new menu directory to the Applications menu item, you can add entries in the/etc/xdg/menus directory;
The entries in the <Menu> Level 2 Directory are exactly the same as those in desktop Applications. If the entry content is blank, it will not be displayed in Applications; for example, in applications. the menu file contains the Education Directory menu, but because no program is used in the/usr/share/applications directory
Categories = Education;
Therefore, the Education Sub-directory menu does not exist in the Applications directory menu. Try to modify any. desktop file (qt4-qtconfig. desktop) and change Categories to Education. The Applications directory Menu displays the Applications --> Education ---> qt4 config
(Rpm-qi xdg-utils-1.0.2-2.fc8) The following scripts are provided at this time:
* Xdg-desktop-menu Install desktop menu items
* Xdg-desktop-icon Install icons to the desktop
* Xdg-icon-resource Install icon resources
* Xdg-mime Query information about file type handling and
Install descriptions for new file types
* Xdg-open Open a file or URL in the user's preferred application
* Xdg-email Send mail using the user's preferred e-mail composer
* Xdg-screensaver Control the screensaver
========================================================== ===
[Root @ localhost menus] # pwd
/Etc/xdg/menus
[Root @ localhost menus] # ll
Total 60
-Rw-r -- 1 root 12282 Dec 6 16:01 applications. menu
Drwxr-xr-x 2 root 4096 Nov 9 applications-merged
-Rw-r -- 1 root 488 Jul 6 gnome-screensavers.menu
-Rw-r -- 1 root 279 Sep 10 2005 kde-information.menu
-Rw-r -- 1 root 288 Sep 10 2005 kde-screensavers.menu
-Rw-r -- 1 root 2198 Aug 10 kde-settings.menu
-Rw-r -- 1 root 3020 Oct 19 23:53 preferences. menu
Drwxr-xr-x 2 root 4096 Oct 19 23:53 preferences-merged
Drwxr-xr-x 2 root 4096 Nov 9 preferences-post-merged
-Rw-r -- 1 root 1241 Oct 19 server-settings.menu
-Rw-r -- 1 root 1127 Oct 19 settings. menu
-Rw-r -- 1 root 920 Oct 19 start-here.menu
-Rw-r -- 1 root 3294 Oct 19 system-settings.menu
The applications. menu file can be used to set whether a menu item is included in the menu item, or even exclude.
Q) What is the query path of the Program executed by the desktop file?
A: When the program is executed, the PATH is set in the PATH environment variable ,. the desktop file uses exec to specify the application to be executed, and searches for the corresponding application in the PATH defined by PATH. You can view it as follows:
[Root @ localhost ~] # Echo $ PATH
/Usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/sbin: /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
Q) How does the desktop file run the "executable application?
A: You can first read a simple. desktop file:
[Root @ localhost ~] # Cat/usr/share/applications/amule. desktop
[Desktop Entry]
Encoding = UTF-8
// Encoding method
Name = aMule
// Application name,
Comment = aMule
// The prompt name when you move the cursor over it
Exec = amule
// The actual name of the executable Application
Iconw.amule.png
// The icon displayed in the menu item. It can be blank.
Terminal = false
// Whether the terminal is used
Type = Application
// Category
Categories = Application; Network; // category
. The desktop file knows the name of the application through Exec = amule and is case sensitive. You can find it in the default PATH of the PATH environment variable, if no PATH is found, an error is returned unless you have set a special PATH for this application in the PATH.