Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Exec command in desktop file to wezterm start -- #2271

Merged
merged 2 commits into from
Jul 17, 2022
Merged

Change Exec command in desktop file to wezterm start -- #2271

merged 2 commits into from
Jul 17, 2022

Conversation

Anomalocaridid
Copy link
Contributor

Some systems rely on the default terminal emulator's desktop entry for things like launching terminal applications with an application launcher or having a resource opener open a file with a terminal application. Currently, setting WezTerm as the default terminal emulator without overriding its desktop file breaks functionality like this because its desktop entry uses wezterm instead of wezterm start in its Exec field, which just terminates with an error when it is passed a command to run.

@wez
Copy link
Owner

wez commented Jul 17, 2022

Interesting! What do you think about also adding in something like --cwd . in there?
I'm wondering if that might resolve issues like #2103, assuming those other applications are resolving how to run wezterm via the .desktop file

@Anomalocaridid
Copy link
Contributor Author

I was able to replicate the problem with Dolphin in #2103 and I appear to have fixed it by setting the Exec field in WezTerm's desktop entry to wezterm start --cwd . --.

@wez wez merged commit 4e2b5cd into wez:main Jul 17, 2022
wez added a commit that referenced this pull request Jul 17, 2022
@wez
Copy link
Owner

wez commented Jul 17, 2022

Thanks!

@Anomalocaridid Anomalocaridid deleted the desktop-file branch July 17, 2022 14:47
@vimpostor
Copy link
Contributor

vimpostor commented Sep 28, 2022

FYI I think this commit broke mailto: links when using wezterm as default terminal emulator with a terminal email client.

For example when mutt is configured as the default email program, executing xdg-open 'mailto:test@test.com' prints the following error:

kf.kio.core: Terminal "wezterm start --cwd . --" not found, service "Mutt"
kf.kio.gui: "Terminal „wezterm start --cwd . --“ beim Versuch, „~/.local/share/applications/mutt.desktop“ auszuführen, nicht gefunden"

From a quick glance at the XDG spec it looks like it isn't a wezterm bug though, the Exec= line in the desktop file is allowed to be a whole command line, so I guess I should report the bug at KDE instead.

Edit: Nevermind, it was a KDE issue and fixed in KDE/kio@ad27f0e

vimpostor added a commit to vimpostor/wezterm that referenced this pull request Oct 26, 2022
In a56904e the desktop file was patched
to use "wezterm start" instead of "wezterm". As an unneeded addendum
that patch also included the unnecessary addition of ending command-line
parsing by passing the "--" option at the end.

As it turns out, some consumers of wezterm's desktop file want wezterm
to parse command line flags. For example KDE's kio passes the whole
cmdline via the "-e" flag, because it is widely used for most terminal
emulators as the primary mean of passing the cmdline.

To solve this we remove the unneeded "--" again, because we now also
support the "-e" option.
After all, all trailing arguments will automatically be parsed by
wezterm as the cmdline of the program to run.
The only sideeffect of this change is that we now cannot longer start
programs that share a name with a "wezterm start" option, for example if
the user has installed an executable at /usr/bin/--always-new-process
then this edge case will not work anymore.
Given that this would be an extremely unlikely scenario, it makes more
sense to improve compatibility by supporting the usecase of passing the
cmdline with the "-e" flag.

refs: wez#2622
refs: wez#2271
refs: https://bugs.kde.org/show_bug.cgi?id=459616
vimpostor added a commit to vimpostor/wezterm that referenced this pull request Nov 2, 2022
In a56904e the desktop file was patched
to use "wezterm start" instead of "wezterm". As an unneeded addendum
that patch also included the unnecessary addition of ending command-line
parsing by passing the "--" option at the end.

As it turns out, some consumers of wezterm's desktop file want wezterm
to parse command line flags. For example KDE's kio passes the whole
cmdline via the "-e" flag, because it is widely used for most terminal
emulators as the primary mean of passing the cmdline.

To solve this we remove the unneeded "--" again, because we now also
support the "-e" option.
After all, all trailing arguments will automatically be parsed by
wezterm as the cmdline of the program to run.
The only sideeffect of this change is that we now cannot longer start
programs that share a name with a "wezterm start" option, for example if
the user has installed an executable at /usr/bin/--always-new-process
then this edge case will not work anymore.
Given that this would be an extremely unlikely scenario, it makes more
sense to improve compatibility by supporting the usecase of passing the
cmdline with the "-e" flag.

refs: wez#2622
refs: wez#2271
refs: https://bugs.kde.org/show_bug.cgi?id=459616
wez pushed a commit that referenced this pull request Nov 4, 2022
In a56904e the desktop file was patched
to use "wezterm start" instead of "wezterm". As an unneeded addendum
that patch also included the unnecessary addition of ending command-line
parsing by passing the "--" option at the end.

As it turns out, some consumers of wezterm's desktop file want wezterm
to parse command line flags. For example KDE's kio passes the whole
cmdline via the "-e" flag, because it is widely used for most terminal
emulators as the primary mean of passing the cmdline.

To solve this we remove the unneeded "--" again, because we now also
support the "-e" option.
After all, all trailing arguments will automatically be parsed by
wezterm as the cmdline of the program to run.
The only sideeffect of this change is that we now cannot longer start
programs that share a name with a "wezterm start" option, for example if
the user has installed an executable at /usr/bin/--always-new-process
then this edge case will not work anymore.
Given that this would be an extremely unlikely scenario, it makes more
sense to improve compatibility by supporting the usecase of passing the
cmdline with the "-e" flag.

refs: #2622
refs: #2271
refs: https://bugs.kde.org/show_bug.cgi?id=459616
wez added a commit that referenced this pull request Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants