Ubuntu的快捷方式文件.desktop说明

.desktop file.  “There was an error lunching the application”

参考别人的旧文件写的 my-app.desktop

[Desktop Entry]
Encoding=UTF-8
Name=Pycharm
GenericName=Pycharm IDEA
Comment=The Python IDE for Professional Developers
Exec="/home/zhang/Documents/Pycharm/pycharm-community-2017.1.3/bin/pycharm.sh" %f
Icon=/home/zhang/Documents/Pycharm/pycharm-community-2017.1.3/bin/pycharm.png
Terminal=false
Type=Application
Categories=Application;Programme;

双击的时候一直提示上面错误,在ubuntu论坛上找到解决办法:

(https://askubuntu.com/questions/496367/desktop-file-running-sh-script-there-was-an-error-launching-the-application/836842#836842)

desktop-file-validate your-file-here.desktop

“ This was the hidden command I was trying to find since hours. This, Saved my day :-)

This command will show you warning and errors wherever you have gone wrong.Credits : ubuntuforums ”

执行此命令,终端提示:

 

$ desktop-file-validate Pycharm.desktopPycharm.desktop: warning: key "Encoding" in group "Desktop Entry" is deprecated
Pycharm.desktop: warning: value "Application;Programme;" for key "Categories" in group "Desktop Entry" contains a deprecated value "Application"
Pycharm.desktop: error: value "Application;Programme;" for key "Categories" in group "Desktop Entry" contains an unregistered value "Programme"; values extending the format should start with "X-"
Pycharm.desktop: hint: value "Application;Programme;" for key "Categories" in group "Desktop Entry" does not contain a registered main category; application might only show up in a "catch-all" section of the application menu

根据提示,修改.desktop文件(去掉.desktop文件的Categories的value“Programme”, "Application"改成“X-Application”,Ok)

成功的.desktop文件如下:

[Desktop Entry]
Encoding=UTF-8
Name=Pycharm
GenericName=Pycharm IDEA
Comment=The Python IDE for Professional Developers
Exec="/home/zhang/Documents/Pycharm/pycharm-community-2017.1.3/bin/pycharm.sh" %f
Icon=/home/zhang/Documents/Pycharm/pycharm-community-2017.1.3/bin/pycharm.png
Terminal=false
Type=Application
Categories=X-Application

快捷方式图标的存放位置: /usr/share/applications 。将.desktop 文件移到该目录下。

 

 

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值