This PR adds a feature to automatically cycle through screen shares during calls, designed for demo days or any call that has a lot of screen share use. This is a preliminary attempt behind a feature flag so we can dogfood and iterate, or toss it out. There's a new toggle next to the active channel name in the collab panel: **Auto Watch Screens**. https://github.com/user-attachments/assets/ae6eccec-7921-4c1f-8921-c8093631c705 This video demonstrates some cases: Basic auto-watch - Toggle on → automatically opens the next screen share that starts - When the watched screen share ends, switches to the next available share Queuing - Someone starts sharing while another share is active → doesn't interrupt the current share - When the current share ends, the queued share is picked up automatically Paused while sharing - Auto-watch pauses when you start sharing your own screen, so other shares don't pop up during your presentation - When you stop sharing, auto-watch resumes and opens the next available share Multiple watchers - Multiple people can have auto-watch enabled independently — they all see the same transitions Note that we don't manage the screenshares, livekit does, so this change is entirely on the client. I think that's mostly fine, but there is a chance 2 separate clients queues up a different person as the next watched peer if they both engage screenshare around the same time, depending on how it hits the clients, but it seems pretty edge case. We can move the implementation to collab, but it will be more of a project, and adding a secondary source alongside of livekit that could get out of sync and have its own issues. UI/UX needs work (@danilo-leal for suggestions) Self-Review Checklist: - [X] I've reviewed my own diff for quality, security, and reliability - [X] Unsafe blocks (if any) have justifying comments - [X] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [X] Tests cover the new/changed behavior - [X] Performance impact has been considered and is acceptable Closes #ISSUE Release Notes: - N/A --------- Co-authored-by: Yara 🏳️⚧️ <11743287+yara-blue@users.noreply.github.com>
Zed Server
This crate is what we run at https://collab.zed.dev.
It contains our back-end logic for collaboration, to which we connect from the Zed client via a websocket after authenticating via https://zed.dev, which is a separate repo running on Vercel.
Local Development
Database setup
Before you can run the collab server locally, you'll need to set up a zed Postgres database. Follow the steps sequentially:
- Ensure you have postgres installed. If not, install with
brew install postgresql@15. - Follow the steps on Brew's formula and verify your
$PATHcontains/opt/homebrew/opt/postgresql@15/bin. - If you hadn't done it before, create the
postgresuser withcreateuser -s postgres. - You are now ready to run the
bootstrapscript:
script/bootstrap
This script will set up the zed Postgres database, and populate it with some users. It requires internet access, because it fetches some users from the GitHub API.
The script will create several admin users, who you'll sign in as by default when developing locally. The GitHub logins for the default users are specified in the seed.default.json file.
To use a different set of admin users, create crates/collab/seed.json.
{
"admins": ["yourgithubhere"],
"channels": ["zed"]
}
Testing collaborative features locally
In one terminal, run Zed's collaboration server and the livekit dev server:
foreman start
In a second terminal, run two or more instances of Zed.
script/zed-local -2
This script starts one to four instances of Zed, depending on the -2, -3 or -4 flags. Each instance will be connected to the local collab server, signed in as a different user from seed.json or seed.default.json.
Deployment
We run two instances of collab:
- Staging (https://staging-collab.zed.dev)
- Production (https://collab.zed.dev)
Both of these run on the Kubernetes cluster hosted in Digital Ocean.
Deployment is triggered by pushing to the collab-staging (or collab-production) tag in GitHub. The best way to do this is:
./script/deploy-collab staging./script/deploy-collab production
You can tell what is currently deployed with ./script/what-is-deployed.