Closes#20070
Release Notes:
- Fixed issue where files wouldn't open from the file explorer.
- Fixed "Open a new workspace" option on the desktop entry right-click
menu.
Context:
Zed consists of two binaries:
- `zed` (CLI component, located at `crates/cli/main.rs`)
- `zed-editor` (GUI component, located at `crates/zed/main.rs`)
When `zed` is used in the terminal, it checks if an existing instance is
running. If one is found, it sends data via a socket to open the
specified file. Otherwise, it launches a new instance of `zed-editor`.
For more details, see the `detect` and `boot_background` functions in
`crates/cli/main.rs`.
Root Cause:
Install process creates directories like `.local/zed.app` and
`.local/zed-preview.app`, which contain desktop entries for the
corresponding release. For example, `.local/zed.app/share/applications`
contains `zed.desktop`.
This desktop entry includes a generic `Exec` field, which is correct by
default:
```sh
Comment=A high-performance, multiplayer code editor.
TryExec=zed
StartupNotify=true
```
The issue is in the `install.sh` script. This script copies the above
desktop file to the common directory for desktop entries
(.local/share/applications). During this process, it replaces the
`TryExec` value from `zed` with the exact binary path to avoid relying
on the shell's PATH resolution and to make it explicit.
However, replacement incorrectly uses the path for `zed-editor` instead
of the `zed` CLI binary. This results in not opening a file as if you
use `zed-editor` directly to do this it will throw `zed is already
running` error on production and open new instance on dev.
Note: This PR solves it for new users. For existing users, they will
either have to update `.desktop` file manually, or use `install.sh`
script again. I'm not aware of zed auto-update method, if it runs
`install.sh` under the hood.
This PR fixes some spots in the docs and the `install.sh` script that
were using a mix of tabs and spaces.
We should just be using spaces.
Release Notes:
- N/A
This was broken by two things:
1. A merge conflict in the install.sh script leading to bad sh syntax
2. A return removed by accident when we refactored main
Release Notes:
- N/A
Fixes#12585
This changes the expectations for installed binaries on linux based on
work
that @jirutka has done for Alpine.
In particular, we now put the cli in place as `bin/zed` and the zed
binary as
`libexec/zed-editor`, and assume that packagers do the same.
cc @someone13574
Release notes:
- N/A
---------
Co-authored-by: Mikayla <mikayla@zed.dev>
- [x] Build out cli on linux
- [x] Add support for --dev-server-token sent by the CLI
- [x] Package cli into the .tar.gz
- [x] Link the cli to ~/.local/bin in install.sh
Release Notes:
- linux: Add cli support for managing zed
This undoes the changes from #11333 and uses the path of the `.desktop`
file instead.
According ot the spec
(https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html)
the filename and path of the `desktop` file are used to determine the
desktop file ID.
This is enough to match the windows (which have the same WMClass/app-id)
with the desktop entry.
Release Notes:
- N/A