https://bugs.kde.org/show_bug.cgi?id=460387

            Bug ID: 460387
           Summary: desktopexec parser always prepends "-e" to cmdline
                    when invoking terminal applications
    Classification: Frameworks and Libraries
           Product: frameworks-kio
           Version: 5.99.0
          Platform: Archlinux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kio-bugs-n...@kde.org
          Reporter: magnus.gros...@gmail.com
                CC: kdelibs-b...@kde.org
  Target Milestone: ---

SUMMARY
When configuring some terminal application as the default application for some
filetype and then opening that file type with "xdg-open", KDE will start that
application by passing the cmdline of the desktop file to the terminal emulator
with "-e" prepended.

Basically, KDE assumes that every terminal emulator uses and understands "-e"
to pass the cmdline.
But this is not universally true for every terminal emulator, for example not
for wezterm.

I already tried reporting the bug at wezterm here:
https://github.com/wez/wezterm/issues/2622
But the maintainer wanted to at least discuss this first on the KDE side -
rightfully so, as passing the cmdline with "-e" is not standard, and not
officially defined in the XDG spec.

The offending code in kio can be found here:
https://github.com/KDE/kio/blob/ad27f0e299e7a7a1f4059431f882f9a4ebba71fd/src/core/desktopexecparser.cpp#L532

I understand it is probably not possible to completely remove the "-e" thing,
as other terminals such as konsole expect the cmdline like this, but do you
think it is possible to implement a workaround in KDE that automatically
detects which applications need "-e" and which ones don't?


STEPS TO REPRODUCE
1. Configure wezterm as the default terminal emulator in KDE Settings
2. Configure terminal vim as the default application for opening .txt files
(The vim desktop file must contain "Terminal=true")
3. Open an arbitrary text file with "xdg-open /tmp/file.txt"

OBSERVED RESULT
KDE assumes that the terminal emulator uses and understands "-e" to get the
cmdline, but that is not the case for every terminal emulator including
wezterm, which prints the following error:

"ERROR  wezterm_gui > Unable to spawn -e because it doesn't exist on the
filesystem and was not found in PATH; terminating"

EXPECTED RESULT
KDE does not pass the cmdline with "-e", after all the desktop file of wezterm
is already configured to support passing cmdlines:
Exec=wezterm start --cwd . --

Thus, KDE should only pass the cmdline as given in the vim desktop file to
wezterm's Exec line, not prepend it with "-e".

KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.99
Qt Version: 6.4/5.15

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to