• 企业400电话
  • 微网小程序
  • AI电话机器人
  • 电商代运营
  • 全 部 栏 目

    企业400电话 网络优化推广 AI电话机器人 呼叫中心 网站建设 商标✡知产 微网小程序 电商运营 彩铃•短信 增值拓展业务
    CentOS桌面菜单如何编辑和配置?

    相关配置文件:

    /usr/share/applications目录中的 *.desktop文件

    相关目录:

    $HOME/.config/menus

    /etc/xdg/menus

    /usr/share/desktop-directories

    修改后一般要更新数据库:

    updatedb, update-desktop-database

    update-desktop-database和update-desktop-*系列程序都位于xdg-utils 包中

    --------------------------------------------------------------------------------------------------------------------------

    qt4-qtconfig位于System-Administration,现在要把它更改到Applications-->Programming菜单下面:

    更改(vim /usr/share/applications/qt4-qtconfig.desktop)其中的

    Categories=Qt;Settings;为 Categories=Qt;Development;

    为何不是Categories=Qt;Programming;呢?

    切换到/usr/share/desktop-directories目录下面:

    [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

    打开Development.directory文件,开头如下

    [Desktop Entry]

    Name=Programming

    ....................

    说明Categories=Development在菜单中对应的就是Programming菜单目录。

    最后,Categories=Qt;Development;同样可以写成Categories=Development;

    如果想在Applications菜单项中添加一个新的菜单目录,可以通过添加/etc/xdg/menus目录中的条目来完成

    其中Menu>二级目录中的条目正好和桌面Applications中的条目相等。对于条目内容为空的,在Applications中将不会显示;比如在applications.menu文件中写有Education目录菜单,但是因为在/usr/share/applications目录下面列举的程序没有程序使用

    Categories=Education;

    所以,在Applications目录菜单中,没有Education子目录菜单。尝试修改任何一个.desktop文件(qt4- qtconfig.desktop),把Categories改成Education,立刻就会在Applications目录菜单中显示出 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--r-- 1 root root 12282 Dec 6 16:01 applications.menu

    drwxr-xr-x 2 root root 4096 Nov 9 17:16 applications-merged

    -rw-r--r-- 1 root root   488 Jul 6 16:58 gnome-screensavers.menu

    -rw-r--r-- 1 root root   279 Sep 10 2005 kde-information.menu

    -rw-r--r-- 1 root root   288 Sep 10 2005 kde-screensavers.menu

    -rw-r--r-- 1 root root 2198 Aug 10 15:03 kde-settings.menu

    -rw-r--r-- 1 root root 3020 Oct 19 23:53 preferences.menu

    drwxr-xr-x 2 root root 4096 Oct 19 23:53 preferences-merged

    drwxr-xr-x 2 root root 4096 Nov 9 17:19 preferences-post-merged

    -rw-r--r-- 1 root root 1241 Oct 19 23:53 server-settings.menu

    -rw-r--r-- 1 root root 1127 Oct 19 23:53 settings.menu

    -rw-r--r-- 1 root root   920 Oct 19 23:53 start-here.menu

    -rw-r--r-- 1 root root 3294 Oct 19 23:53 system-settings.menu

    applications.menu文件可以设置在菜单项中是否包含某个菜单项,甚至可以exclude.

    疑问).desktop文件所执行程序的查询路径是什么?

    答:执行程序时路径设置在PATH环境变量中,.desktop文件通过其中的exec来指定要执行的应用程序,并在PATH所定义的路径中查找相应的应用程序。可以通过如下方式查看:

    [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

    疑问).desktop文件是如何执行”可执行应用程序“的?

    答:可以先看一个简单的.desktop文件内容:

    [root@localhost ~]# cat /usr/share/applications/amule.desktop

    [Desktop Entry]

    Encoding=UTF-8

    //编码方式

    Name=aMule

    //应用程序名称,

    Comment=aMule

    //鼠标经过上面时的提示名称

    Exec=amule

    //可执行应用程序的实际名称

    Icon=amule.png

    //显示在菜单项中的图标,可以为空

    Terminal=false

    //是否使用终端

    Type=Application

    //分类

    Categories=Application;Network; //分类

    .desktop文件通过上述Exec=amule知道了应用程序的名称,并且区分大小写,并在PATH环境变量所默认设定的路径中查找,查找到即可执行,查找不到则报错,除非用户自己在PATH中设定了此应用程序所处的特殊路径。

    上一篇:CentOS下如何添加动态链接库?
    下一篇:CentOS的管理终端界面详解
  • 相关文章
  • 

    © 2016-2020 巨人网络通讯 版权所有

    《增值电信业务经营许可证》 苏ICP备15040257号-8

    CentOS桌面菜单如何编辑和配置? CentOS,桌面,菜单,如何,编辑,