一、启动器目录
/usr/share/applications
目标执行程序可以在任意目录,但是启动器必须在该目录下。在该目录下操作文件需要管理员权限,建议创建好启动器文件后再使用管理员权限拷贝到该目录。
sudo cp filename filename
管理员权限拷贝文件。
二、启动器命名
应用名称.desktop
以.desktop后缀的文件
三、启动器内容
[Desktop Entry]
Version=1.0
Name=hello_app
Name[zh_CN]=HelloApp
Comment=hello_app
Comment[zh_CN]=helloapp
GenericName=Hello App
GenericName[zh_CN]=网络浏览器
Keywords=Internet;WWW;Browser;Web;Explorer
Keywords[zh_CN]=Internet;WWW;Browser;Web;Explorer;网页;浏览;上网;火狐;Firefox;ff;互联网;网站;
Exec=/home/lee/桌面/hello_app/hello_app
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
StartupNotify=true
Actions=new-window;new-private-window;
[Desktop Action new-window]
Name=Open a New Window
Name[zh_CN]=新建窗口
Name[zh_TW]=開啟新視窗
Exec=firefox -new-window
[Desktop Action new-private-window]
Name=Open a New Private Window
Name[zh_TW]=開啟新隱私瀏覽視窗
Exec=firefox -private-window
项目解释:
项目 | 解释 |
---|---|
Encoding=UTF-8 | 编码 |
Version=1.0 | 版本 |
Name=hello_app | 名称(默认) |
Name[zh_CN]=HelloApp | 名称(简体中文),更改**[语言缩写]**添加多语言 |
Comment=hello_app | 注释(默认) |
Comment[zh_CN]=helloapp | 注释(简体中文),更改**[语言缩写]**添加多语言 |
GenericName=Hello App | 描述(默认) |
GenericName[zh_CN]=网络浏览器 | 描述(简体中文),更改**[语言缩写]**添加多语言 |
Keywords=Internet;WWW;Browser;Web;Explorer | 关键词(默认) |
Keywords[zh_CN]=Internet;网站; | 关键词(简体中文),更改**[语言缩写]**添加多语言 |
Exec=/home/lee/桌面/hello_app/hello_app | 执行的命令/程序(绝对路径,可添加启动参数) |
Terminal=true | 是否使用终端(true重启系统后启动应用会同时打开终端窗口) |
X-MultipleArgs=false | |
Type=Application | 启动类型 |
Icon=firefox | 图标(可指定png图标) |
Categories=GNOME;GTK;Network;WebBrowser; | 应用类型 |
StartupNotify=true | |
Actions=new-window;new-private-window; | 启动器图标鼠标右键菜单列表,对应下面的菜单配置 |
[Desktop Action new-window] | 启动器右键菜单1 |
Name=Open a New Window | 菜单名 |
Name[zh_CN]=新建窗口 | 菜单名(简体中文) |
Name[zh_TW]=開啟新視窗 | 菜单名(繁体中文) |
Exec=firefox -new-window | 菜单执行命令/程序(绝对路径,可添加启动参数) |
[Desktop Action new-private-window] | 启动器右键菜单2 |
Name=Open a New Private Window | 菜单名 |
Name[zh_TW]=開啟新隱私瀏覽視窗 | 菜单名(繁体中文) |
Exec=firefox -private-window | 菜单执行命令/程序(绝对路径,可添加启动参数) |
通过启动器启动的程序,如使用了命令行则路径处于用户目录,而不是执行程序所在目录。