大家好
按照GDM3 维基百科为 GNOME 菜单添加桌面文件,
我收到以下错误:
Oct 4 09:54:06 cx-W55xEU gnome-software[1741]: failed to rescan: Failed to parse /home/cx/.local/share/applications/android-studio.desktop file: cannot process file of type application/x-desktop
Oct 4 09:54:47 cx-W55xEU gnome-software[1741]: failed to rescan: Failed to parse /usr/share/applications/android-studio.desktop file: cannot process file of type application/x-desktop
我尝试创建的桌面文件适用于Android Studio。
桌面文件内容
[Desktop Entry]
# The type as listed above
Type=Application
# The version of the desktop entry specification to which this file complies
Version=1.0
# The name of the application
Name=Android-Studio
# A comment which can/will be used as a tooltip
Comment=Android studio IDE
# The path to the folder in which the executable is run
Path=/opt/google/android-studio/android-studio/bin/
# The executable of the application.
Exec=studio.sh
# The name of the icon that will be used to display this entry
Icon=studio.png
# Describes whether this application needs to be run in a terminal or not
Terminal=false
# Describes the categories in which this entry should be shown
Categories=Education;Languages;Java;
指定的路径链接包含:
# ll /opt/google/android-studio/android-studio/bin/
total 152
drwxrwxr-x 1 root root 348 Sep 15 16:17 ./
drwxrwxr-x 1 root root 160 Sep 15 16:17 ../
-rw-r--r-- 1 root root 136 Sep 15 15:49 appletviewer.policy
-rwxr-xr-x 1 root root 23072 Sep 15 15:49 fsnotifier*
-rwxr-xr-x 1 root root 29648 Sep 15 15:49 fsnotifier64*
-rwxr-xr-x 1 root root 26453 Sep 15 15:49 fsnotifier-arm*
-rw-r--r-- 1 root root 7482 Sep 15 15:52 idea.properties
-rwxr-xr-x 1 root root 278 Sep 15 15:49 inspect.sh*
-rw-r--r-- 1 root root 8531 Sep 15 15:49 libbreakgen64.so
-rw-r--r-- 1 root root 6807 Sep 15 15:49 libbreakgen.so
drwxrwxr-x 1 root root 12 Sep 15 16:17 lldb/
-rw-r--r-- 1 root root 2275 Sep 15 15:49 log.xml
-rw-r--r-- 1 root root 527 Sep 15 15:49 studio64.vmoptions
-rw-r--r-- 1 root root 9816 Sep 15 15:49 studio.png
-rwxr-xr-x 1 root root 6876 Sep 15 15:49 studio.sh*
-rw-r--r-- 1 root root 534 Sep 15 15:49 studio.vmoptions
这是一个奇怪的错误,因为我在添加 .desktop 文件时从来没有遇到过这样的问题
有什么想法吗?
答案1
我在谷歌上搜索了一会儿后找到了答案,令人惊讶的是,GDM wiki 上没有提到这个答案,但我偶然从问库本图邮政
解决方案:
bash -i
在可执行文件前面添加,如图所示
Exec=bash -i "/opt/google/android-studio/android-studio/bin/studio.sh" %f
最终解决方案
[Desktop Entry]
# The type as listed above
Type=Application
# The version of the desktop entry specification to which this file complies
Version=1.0
# The name of the application
Name=Android-Studio
# A comment which can/will be used as a tooltip
Comment=Android studio IDE
# The executable of the application.
Exec=bash -i "/opt/google/android-studio/android-studio/bin/studio.sh" %f
# The name of the icon that will be used to display this entry
Icon=/opt/google/android-studio/android-studio/bin/studio.png
# Describes whether this application needs to be run in a terminal or not
Terminal=false
# Describes the categories in which this entry should be shown
Categories=Education;Languages;Java;
StartupNotify=true
另请注意,我添加了一行启动通知。我找到了一个合理的解释,说明其用途,以及.desktop
文件的其他一些组成部分
希望这可以帮助!