linux (deepin) make a startup icon (shortcut) on the desktop

   In linux (deepin), applications downloaded from Deepin Store will automatically create shortcuts in the launcher, but applications downloaded from the browser or neutrally installed from the terminal can only find the installed directory, click and open , It’s very inconvenient. Here I will share the way I found to create a startup icon on the launcher. 
By default, all shortcuts of the system are placed in /usr/share/applications. Open the directory and you will see a large number of .desktop files, each of which is a shortcut.

Take the creation of idea.desktop desktop shortcut as an example

Every time you start, you need to execute it in the idea directory bin:

./idea.sh

This is more troublesome, now we create a shortcut on the desktop:

//创建快捷方式
touch idea.desktop
//编辑此文件
vi idea.desktop
//.创建一个 idea.desktop 文件,添加以下内容: 
[Desktop Entry]
Name=IdeaIU
Comment=IdeaIU
Exec=.0_171 /home/liumeng/dev/Idea/idea-IU-/bin/idea.sh
Icon=/home/liumeng/dev/Idea/idea-IU-/bin/idea.png
Terminal=false
Type=Application
Categories=Application;
X-Deepin-CreatedBy=com.deepin.dde.daemon.Launcher
X-Deepin-AppID=idea

"Exec" is the path to execute the script, and "Icon" is the icon path.

If you cannot open it, you can give it executable permission. The desktop file needs executable permission to run, otherwise it will be opened as a text file. A shortcut has already appeared. Copy or move this shortcut to /usr/share/applications Just under the folder.

移动:$sudo mv /bin/idea.desktop /usr/share/applications
复制:$sudo cp /home/netlogin/Desktop/*.desktop        /usr/share/applications
The following is the Desktop file template information  

  Desktop file template

A desktop file is mainly composed of two parts, the header [Desktop Entry] statement (used to specify that this is a desktop file) and a series of parameter/value pairs. A desktop file must specify at least 3 parameter values ​​(Name, Type, and Exec).

Parameter description:
Name: shortcut name;
Comment: comment;
Exec: start script, the full path of the program execution file;
Icon: the file name and path of the icon.
Terminal: Whether to start with a terminal.

[Desktop Entry] #每个desktop文件都以这个标签开始,说明这是一个Desktop Entry文件Version=1.0 #标明Desktop Entry的版本(可选) 
Type=Application #desktop的类型(必选),常见值有“Application”和“Link”
Name=pycharm#程序名称(必须),这里以创建一个pycharm的快捷方式为例 
Name[zh_CN]=pycharm Name[zh_TW]=pycharm Comment=pycharm #程序描述(可选) 
Comment[zh_CN]=pycharm Comment[zh_TW]=pycharm 
Icon=/home/shenjia/pycharm-community-2018.2.1/bin/pycharm.png #设置快捷方式的图标(可选) Exec=/home/shenjia/pycharm-community-2018.2.1/bin/pycharm.sh %U #程序的启动命令(必选),可以带参数运行,当下面的Type为Application,此项有效 
Categories=Development;IDE; #注明在菜单栏中显示的类别(可选) 
Terminal=false #是否在终端中运行(可选),当Type为Application,此项有效StartupNotify=true

Guess you like

Origin blog.csdn.net/LOVE_Me__/article/details/104848756