发新话题
打印

实例说明:在"应用程序"菜单下创建应用程序快捷菜单

实例说明:在"应用程序"菜单下创建应用程序快捷菜单

一、手动在“应用程序”菜单中创建应用程序快捷菜单。
以下的实例说明是在“应用程序”->“影音”菜单下,创建一个gfashplayer的应用程序菜单。
步骤1:查看当前的路径。
[root@localhost 0811]# pwd
/home/0811
步骤2:准备工作,gflashplayer为可执行程序,lupa.png为应用程序的图标。
[root@localhost 0811]# ls
gflashplayer  lupa.png
步骤3:可执行文件gflashplayer拷贝到 /usr/bin目录下。
[root@localhost 0811]# cp gflashplayer /usr/bin/
步骤4:把用来显示的图标lupa.png 拷贝到 /usr/share/pixmaps 。
[root@localhost 0811]# cp lupa.png /usr/share/pixmaps/
步骤5:新建一个“hello.desktop”文件,并拷贝到/usr/share/applications 。
[root@localhost 0811]# gedit gflashplayer.desktop
内容如下:
[Desktop Entry]
Name=gflashPlayer
Name[zh_CN]=gflashPlayer 9  #这就是菜单项的名称
GenericName=Media Player
Exec=gflashplayer
Type=Application
Encoding=UTF-8
Icon=lupa.png
Categories=GNOME;Application;AudioVideo;Audio;VideoP
layer
MimeType=video/gflashplayer
[root@localhost 0811]# cp gflashplayer.desktop /usr/share/applications

此时在“应用程序”->“影音”菜单下,有一个名为”gflashplayer”的图标,单击它时会弹出如下图1所示:

图1
二、在桌面上手动创建快捷方式:
步骤1:右键桌面,并点击“创建启动器....”菜单,会弹出如下图2所示

图2

图3
步骤2:在图2中,名称处:gflashplayer;命令处:gflashplayer;也可以用“浏览”按钮,找到可执行文件所在路径;点击左上角的图标按钮,在/usr/share/pixmaps/目录下找到lupa.png图标,如图3所示。最后点击“确定”即可。


关于Desktop Entry文件的相关资料可参考以下网址
http://www.ibm.com/developerworks/cn/linux/l-cn-dtef/

喜欢用第二种..界面的
呵呵,目的为了让初学者了解/usr/bin、/usr/share/pixmaps、/usr/share/applications目录的作用,及.desktop文件的编写规则
蛮实用的
呵呵,谢谢大家支持.....................
发新话题