Ubuntu 22.04“.desktop”Exec 不起作用

Ubuntu 22.04“.desktop”Exec 不起作用

您好,我遇到这个问题已经 4 个小时了,一直在尝试解决它,但一直没有成功。摘要:“.desktop 文件的 Exec 部分不起作用,我执行了“chmod +x”命令。我用“desktop-file-validate”命令测试了它。

[Desktop Entry]
Name=MO2 Fallout 4
Comment= Mod Organizer 2
Exec="STEAM_COMPAT_CLIENT_INSTALL_PATH='/home/ruben/.steam/steam' STEAM_CLIENT_INSTALL_PATH='/user/games/steam' STEAM_COMPAT_DATA_PATH='/home/ruben/.steam/debian-installation/steamapps/compatdata/377160/' '/home/ruben/.steam/debian-installation/steamapps/common/Proton - Experimental/proton' run '/home/ruben/.steam/debian-installation/steamapps/compatdata/377160/pfx/drive_c/Modding/MO2/ModOrganizer.exe'"
Icon=/home/ruben/.local/share/icons/MO2F4ICON.ico
Terminal=false
Type=Application
Categories=Game;

注意:通过 Termial 运行代码时它可以正常工作。

STEAM_COMPAT_CLIENT_INSTALL_PATH='/home/ruben/.steam/steam' STEAM_CLIENT_INSTALL_PATH='/user/games/steam' STEAM_COMPAT_DATA_PATH='/home/ruben/.steam/debian-installation/steamapps/compatdata/377160/' '/home/ruben/.steam/debian-installation/steamapps/common/Proton - Experimental/proton' run '/home/ruben/.steam/debian-installation/steamapps/compatdata/377160/pfx/drive_c/Modding/MO2/ModOrganizer.exe'

我尝试创建一个如下所示的脚本(.sh),该脚本可以通过终端运行,但不能通过.desktop 运行。

#!/bin/bash


# Set environment variables (replace paths if necessary)
export STEAM_COMPAT_CLIENT_INSTALL_PATH=~/.STEAM/STEAM
export STEAM_CLIENT_INSTALL_PATH=/user/games/steam
export STEAM_COMPAT_DATA_PATH=~/.steam/debian-installation/steamapps/compatdata/377160/

~/.steam/debian-installation/steamapps/common/Proton\ -\ Experimental/proton run ~/.steam/debian-installation/steamapps/compatdata/377160/pfx/drive_c/Modding/MO2/ModOrganizer.exe

更新:.desktop 运行脚本。

[Desktop Entry]
Name=MO2 Fallout 4
Comment= Mod Organizer 2
Exec=sh ./home/ruben/.local/share/applications/Scripts/MO2F4.sh
Icon=/home/ruben/.local/share/icons/MO2F4ICON.ico
Terminal=false
Type=Application
Categories=Game;

这是我第一次在 askubuntu.com 上提问,如果我遗漏了一些信息,我深表歉意。注意:当我使用脚本 (.sh) 时,图标会显示在我的应用程序中,但如果我不使用,图标就不会显示。

相关内容