一开始我想自己写一个desktop文件放在/usr/share/applications下面,结果在右键菜单里面找不到vscode。
[Desktop Entry]
Categories=Development;IDE;TextEditor;
Comment=编辑器
Exec="/home/weiyinfu/Documents/VSCode-linux-x64/bin/code" %f
Version=1.0
Name=VS Code
Terminal=false
Type=Application
Icon=/home/weiyinfu/Documents/VSCode-linux-x64/resources/app/resources/linux/code.png
StartupWMClass=vscode
经过一番思索,apt-get install deepin-editor安装deepin自带的编辑器,把深度编辑这个软件的desktop文件改成vscode的。
[Desktop Entry]
Categories=Utility;TextEditor;
Comment=Simple and easy to use deepin editor
Exec="/home/weiyinfu/Documents/VSCode-linux-x64/bin/code" %F
GenericName=vscode2
Icon=deepin-editor
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-patch;text/x-adasrc;text/x-chdr;text/x-csrc;text/css;application/x-desktop;text/x-patch;text/x-fortran;text/html;text/x-java;text/x-tex;text/x-makefile;text/x-objcsrc;text/x-pascal;application/x-perl;application/x-perl;application/x-php;text/vnd.wap.wml;text/x-python;application/x-ruby;text/sgml;application/xml;model/vrml;image/svg+xml;application/json;
Name=vscode2
StartupNotify=false
Type=Application
X-Deepin-Vendor=deepin
然后就可以卸载“深度编辑了”。
比较两个文件,可以发现deepin-editor指明了大量的MimeType。只有指明了MimeType的应用才会出现在右键菜单里面。