Bug 495551

Summary: Can't execute desktop files/scripts in Konsole Flatpak
Product: [Frameworks and Libraries] frameworks-kio Reporter: Nate Graham <nate>
Component: generalAssignee: KIO Bugs <kio-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: kdelibs-bugs-null, nicolas.fella
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Flatpak   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nate Graham 2024-10-29 21:58:46 UTC
STEPS TO REPRODUCE
1. Install Konsole from Flathub, and don't install it from your distro (or uninstall it).
2. Create a tiny .desktop file that runs a terminal command, like this:

[Desktop Entry]
Exec=speak-ng hello
Name=Say something
Icon=kmouth
Type=Application
Terminal=true

3. Launch it.

OBSERVED RESULT
An error message saying "Terminal konsole not found while trying to run [path to file]"


EXPECTED RESULT
Konsole opens, the speakers play "hello", and then Konsole closes


ADDITIONAL INFORMATION
System Settings > Default Applications shows "Konsole" as the default terminal app.

The fact that the error message says "konsole" and not "Konsole" leads me to believe that it's trying to run the `konsole` executable, which won't work for a Flatpak app.
Comment 1 Nicolas Fella 2024-10-30 11:59:20 UTC
relevant code is at https://invent.kde.org/frameworks/kio/-/blob/master/src/core/desktopexecparser.cpp#L491

It doesn't handle this correctly, it should be looking up terminal apps by desktop entry name, not command.

KTerminalLauncherJob handles this much better: https://invent.kde.org/frameworks/kio/-/blob/master/src/gui/kterminallauncherjob.cpp#L85
Comment 2 Nate Graham 2024-10-30 14:54:19 UTC
Would it make sense to port it to use KTerminalLauncherJob directly?
Comment 3 Nicolas Fella 2024-10-30 15:13:43 UTC
Maybe. Or extract the relevant part of it into a shared function