Add ZED_ALWAYS_ACTIVE env var, use it in local collaboration script
This makes zed always behave as if the app is active, even if no window is focused. It prevents the 'viewing a window outside of zed' state during collaboration.
This commit is contained in:
parent
026b3a1d0f
commit
555c9847d4
3 changed files with 13 additions and 6 deletions
|
@ -6,7 +6,10 @@ use anyhow::{anyhow, Result};
|
||||||
use audio::Audio;
|
use audio::Audio;
|
||||||
use call_settings::CallSettings;
|
use call_settings::CallSettings;
|
||||||
use channel::ChannelId;
|
use channel::ChannelId;
|
||||||
use client::{proto, ClickhouseEvent, Client, TelemetrySettings, TypedEnvelope, User, UserStore};
|
use client::{
|
||||||
|
proto, ClickhouseEvent, Client, TelemetrySettings, TypedEnvelope, User, UserStore,
|
||||||
|
ZED_ALWAYS_ACTIVE,
|
||||||
|
};
|
||||||
use collections::HashSet;
|
use collections::HashSet;
|
||||||
use futures::{future::Shared, FutureExt};
|
use futures::{future::Shared, FutureExt};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
|
@ -356,12 +359,13 @@ impl ActiveCall {
|
||||||
project: Option<&ModelHandle<Project>>,
|
project: Option<&ModelHandle<Project>>,
|
||||||
cx: &mut ModelContext<Self>,
|
cx: &mut ModelContext<Self>,
|
||||||
) -> Task<Result<()>> {
|
) -> Task<Result<()>> {
|
||||||
self.location = project.map(|project| project.downgrade());
|
if project.is_some() || !*ZED_ALWAYS_ACTIVE {
|
||||||
if let Some((room, _)) = self.room.as_ref() {
|
self.location = project.map(|project| project.downgrade());
|
||||||
room.update(cx, |room, cx| room.set_location(project, cx))
|
if let Some((room, _)) = self.room.as_ref() {
|
||||||
} else {
|
return room.update(cx, |room, cx| room.set_location(project, cx));
|
||||||
Task::ready(Ok(()))
|
}
|
||||||
}
|
}
|
||||||
|
Task::ready(Ok(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_room(
|
fn set_room(
|
||||||
|
|
|
@ -62,6 +62,8 @@ lazy_static! {
|
||||||
.and_then(|v| v.parse().ok());
|
.and_then(|v| v.parse().ok());
|
||||||
pub static ref ZED_APP_PATH: Option<PathBuf> =
|
pub static ref ZED_APP_PATH: Option<PathBuf> =
|
||||||
std::env::var("ZED_APP_PATH").ok().map(PathBuf::from);
|
std::env::var("ZED_APP_PATH").ok().map(PathBuf::from);
|
||||||
|
pub static ref ZED_ALWAYS_ACTIVE: bool =
|
||||||
|
std::env::var("ZED_ALWAYS_ACTIVE").map_or(false, |e| e.len() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const ZED_SECRET_CLIENT_TOKEN: &str = "618033988749894";
|
pub const ZED_SECRET_CLIENT_TOKEN: &str = "618033988749894";
|
||||||
|
|
|
@ -44,6 +44,7 @@ position_2=${half_width},${y}
|
||||||
|
|
||||||
# Authenticate using the collab server's admin secret.
|
# Authenticate using the collab server's admin secret.
|
||||||
export ZED_STATELESS=1
|
export ZED_STATELESS=1
|
||||||
|
export ZED_ALWAYS_ACTIVE=1
|
||||||
export ZED_ADMIN_API_TOKEN=secret
|
export ZED_ADMIN_API_TOKEN=secret
|
||||||
export ZED_SERVER_URL=http://localhost:8080
|
export ZED_SERVER_URL=http://localhost:8080
|
||||||
export ZED_WINDOW_SIZE=${half_width},${height}
|
export ZED_WINDOW_SIZE=${half_width},${height}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue