commit
7b291df21f
10 changed files with 73 additions and 11 deletions
|
@ -38,7 +38,9 @@ use terminal_view::{get_working_directory, TerminalView};
|
|||
use fs::RealFs;
|
||||
use settings::watched_json::{watch_keymap_file, watch_settings_file, WatchedJsonFile};
|
||||
use theme::ThemeRegistry;
|
||||
use util::{channel::RELEASE_CHANNEL, paths, ResultExt, StaffMode, TryFutureExt};
|
||||
#[cfg(debug_assertions)]
|
||||
use util::StaffMode;
|
||||
use util::{channel::RELEASE_CHANNEL, paths, ResultExt, TryFutureExt};
|
||||
use workspace::{
|
||||
self, item::ItemHandle, notifications::NotifyResultExt, AppState, NewFile, OpenPaths, Workspace,
|
||||
};
|
||||
|
@ -567,6 +569,14 @@ async fn handle_cli_connection(
|
|||
if let Some(request) = requests.next().await {
|
||||
match request {
|
||||
CliRequest::Open { paths, wait } => {
|
||||
let paths = if paths.is_empty() {
|
||||
workspace::last_opened_workspace_paths()
|
||||
.await
|
||||
.map(|location| location.paths().to_vec())
|
||||
.unwrap_or(paths)
|
||||
} else {
|
||||
paths
|
||||
};
|
||||
let (workspace, items) = cx
|
||||
.update(|cx| workspace::open_paths(&paths, &app_state, cx))
|
||||
.await;
|
||||
|
|
|
@ -38,7 +38,7 @@ use std::{borrow::Cow, env, path::Path, str, sync::Arc};
|
|||
use util::{channel::ReleaseChannel, paths, ResultExt, StaffMode};
|
||||
use uuid::Uuid;
|
||||
pub use workspace;
|
||||
use workspace::{sidebar::SidebarSide, AppState, Workspace};
|
||||
use workspace::{sidebar::SidebarSide, AppState, Restart, Workspace};
|
||||
|
||||
#[derive(Deserialize, Clone, PartialEq)]
|
||||
pub struct OpenBrowser {
|
||||
|
@ -130,6 +130,7 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
|
|||
},
|
||||
);
|
||||
cx.add_global_action(quit);
|
||||
cx.add_global_action(restart);
|
||||
cx.add_global_action(move |action: &OpenBrowser, cx| cx.platform().open_url(&action.url));
|
||||
cx.add_global_action(move |_: &IncreaseBufferFontSize, cx| {
|
||||
cx.update_global::<Settings, _, _>(|settings, cx| {
|
||||
|
@ -403,6 +404,10 @@ pub fn build_window_options(
|
|||
}
|
||||
}
|
||||
|
||||
fn restart(_: &Restart, cx: &mut gpui::MutableAppContext) {
|
||||
cx.platform().restart();
|
||||
}
|
||||
|
||||
fn quit(_: &Quit, cx: &mut gpui::MutableAppContext) {
|
||||
let mut workspaces = cx
|
||||
.window_ids()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue