Bug 456433

Summary: Terminal not found error while trying to run desktop file when the default terminal's Exec includes arguments
Product: [Frameworks and Libraries] frameworks-kio Reporter: Jakub Kuczys <me>
Component: generalAssignee: KIO Bugs <kio-bugs-null>
Status: REPORTED ---    
Severity: normal CC: a.samirh78, kdelibs-bugs-null, me, nate
Priority: NOR    
Version First Reported In: 5.92.0   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jakub Kuczys 2022-07-07 07:37:12 UTC
SUMMARY
When I try to run a desktop file, I get an error:
```
Unknown error code 100
Terminal kitty --single-instance not found while trying to run /home/ubuntu/Desktop/SleepFor5Seconds.desktop
Please send a full bug report at https://bugs.kde.org.
```
When trying to pinpoint this issue, it turns out that the issue is caused by kitty's `kitty.desktop` file containing more than just the executable in the `Exec=` line:
```
[Desktop Entry]
Version=1.0
Type=Application
Name=kitty
GenericName=Terminal emulator
Comment=Fast, feature-rich, GPU based terminal
TryExec=kitty
Exec=kitty --single-instance
Icon=/home/ubuntu/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png
Categories=System;TerminalEmulator;
```

STEPS TO REPRODUCE
1.  Create a desktop file (under path  `~/.local/share/applications/SOME_NAME.desktop`) for a terminal with some arguments, here's an example for Konsole that I tested with:
```
[Desktop Entry]
Version=1.0
Type=Application
Name=Konsole 2
GenericName=Terminal emulator
Exec=konsole --new-tab
Categories=System;TerminalEmulator;
```
2. Create a desktop file (under path `~/Desktop/SOME_NAME.desktop`) with Terminal=true, here's an example that just runs `sleep 5`:
```
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=sleep 5
GenericName[en_US]=
GenericName=
Icon=system-run
MimeType=
Name[en_US]=Sleep for 5 seconds
Name=Sleep for 5 seconds
Path=
StartupNotify=true
Terminal=true
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
```
3. Double click the newly created file on the desktop.
4. See the error.

OBSERVED RESULT
Plasma shell failed to run the desktop file:
```
Unknown error code 100
Terminal konsole --new-tab not found while trying to run /home/ubuntu/Desktop/SleepFor5Seconds.desktop
Please send a full bug report at https://bugs.kde.org.
```

EXPECTED RESULT
Plasma shell successfully running the desktop file in the terminal using terminal's full command (including arguments).

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: Kubuntu 22.04.0 LTS (kernel version: 5.15.0-40-generic (64-bit))
(available in About System)
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION