Merge pull request #2090 from zed-industries/workspace-window-position-persistence
Workspace window position persistence
This commit is contained in:
commit
ea0dd8972f
28 changed files with 1297 additions and 662 deletions
|
@ -20,7 +20,7 @@ use gpui::{
|
|||
},
|
||||
impl_actions,
|
||||
platform::{WindowBounds, WindowOptions},
|
||||
AssetSource, AsyncAppContext, PromptLevel, TitlebarOptions, ViewContext, WindowKind,
|
||||
AssetSource, AsyncAppContext, Platform, PromptLevel, TitlebarOptions, ViewContext, WindowKind,
|
||||
};
|
||||
use language::Rope;
|
||||
use lazy_static::lazy_static;
|
||||
|
@ -33,6 +33,7 @@ use serde_json::to_string_pretty;
|
|||
use settings::{keymap_file_json_schema, settings_file_json_schema, Settings};
|
||||
use std::{borrow::Cow, env, path::Path, str, sync::Arc};
|
||||
use util::{channel::ReleaseChannel, paths, ResultExt};
|
||||
use uuid::Uuid;
|
||||
pub use workspace;
|
||||
use workspace::{sidebar::SidebarSide, AppState, Workspace};
|
||||
|
||||
|
@ -369,14 +370,22 @@ pub fn initialize_workspace(
|
|||
});
|
||||
}
|
||||
|
||||
pub fn build_window_options() -> WindowOptions<'static> {
|
||||
let bounds = if let Some((position, size)) = ZED_WINDOW_POSITION.zip(*ZED_WINDOW_SIZE) {
|
||||
WindowBounds::Fixed(RectF::new(position, size))
|
||||
} else {
|
||||
WindowBounds::Maximized
|
||||
};
|
||||
pub fn build_window_options(
|
||||
bounds: Option<WindowBounds>,
|
||||
display: Option<Uuid>,
|
||||
platform: &dyn Platform,
|
||||
) -> WindowOptions<'static> {
|
||||
let bounds = bounds
|
||||
.or_else(|| {
|
||||
ZED_WINDOW_POSITION
|
||||
.zip(*ZED_WINDOW_SIZE)
|
||||
.map(|(position, size)| WindowBounds::Fixed(RectF::new(position, size)))
|
||||
})
|
||||
.unwrap_or(WindowBounds::Maximized);
|
||||
|
||||
let screen = display.and_then(|display| platform.screen_by_id(display));
|
||||
|
||||
WindowOptions {
|
||||
bounds,
|
||||
titlebar: Some(TitlebarOptions {
|
||||
title: None,
|
||||
appears_transparent: true,
|
||||
|
@ -386,7 +395,8 @@ pub fn build_window_options() -> WindowOptions<'static> {
|
|||
focus: true,
|
||||
kind: WindowKind::Normal,
|
||||
is_movable: true,
|
||||
screen: None,
|
||||
bounds,
|
||||
screen,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue