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

Add support for custom app_id for window managers #25349

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mkungla
Copy link

@mkungla mkungla commented Feb 21, 2025

This PR adds an app_id field to App, allowing users to set a custom app ID via the new --app-id command-line argument. build_window_options now uses cx.app_id, defaulting to the release channel app ID if none is provided.

Why?

While there are other potential use cases for a custom app_id, I personally use this to make it easier to manage multiple org/project workspaces. Zed’s concepts of Workspaces and Projects can be a bit confusing, and support for multi-root workspaces is currently missing (see issues #9459, #15120, and likely others). There's also no way to open a workspace by ID from workspaces table in db.sqlite.

Instead of making big or breaking changes, this PR introduces a minimal but useful tweak to help mitigate the lack of more advanced workspace support.

For example, having follwing project structure :

org1
    ├── logo.png
    ├── project-1
    ├── project-2
    └── project-3

Then, using a custom .desktop entry, you can assign a unique app_id so that window managers group all projects from the same org together. This doesn’t fully solve the problem of managing complex/multi-root workspaces, but it does provide a small quality-of-life improvement when dealing with massive org codebases.

Example dev.zed.Zed-Org1.desktop entry

[Desktop Entry]
Version=1.0
Type=Application
Name=Org 1
GenericName=Text Editor
TryExec=zed
Exec=zed-editor --app-id dev.zed.Zed-Org1 /devel/org1
Icon=/devel/org1/logo.png
Categories=Workspaces;
Actions=Project1;Project2;Project3;

[Desktop Action Project1]
Exec=zed-editor --app-id dev.zed.Zed-Org1 /devel/org1/project-1
Name=Open a project 1

[Desktop Action Project2]
Exec=zed-editor --app-id dev.zed.Zed-Org1 /devel/org1/project-2
Name=Open a project 2

[Desktop Action Project3]
Exec=zed-editor --app-id dev.zed.Zed-Org1 /devel/org1/project-3
Name=Open a project 3

Release Notes:

  • Add support for custom app_id for window managers and --app-id flag

Added an `app_id` field to `App`, allowing users to specify a custom app_id
via the new `--app_id` command-line argument. The `build_window_options`
function now uses `cx.app_id`, defaulting to the release channel app ID
if none is provided. The app ID is initialized in `main.rs`

Signed-off-by: Marko Kungla <[email protected]>
Copy link

cla-bot bot commented Feb 21, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @mkungla on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@mkungla
Copy link
Author

mkungla commented Feb 21, 2025

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 21, 2025
Copy link

cla-bot bot commented Feb 21, 2025

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title feat: add support for custom app_id for window managers Add support for custom app_id for window managers Feb 21, 2025
@zed-industries-bot
Copy link

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against b2dbe2b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants