From 8d3d3e02a782cde87c478207952bafc0ec61ec16 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 17 Jan 2022 09:31:20 -0700 Subject: [PATCH] add default_workspace config option refs: #1322 refs: #1531 --- config/src/config.rs | 3 +++ docs/changelog.md | 2 +- docs/config/lua/config/default_workspace.md | 6 ++++++ wezterm-gui/src/main.rs | 16 ++++++++++++++-- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 docs/config/lua/config/default_workspace.md diff --git a/config/src/config.rs b/config/src/config.rs index e38fe9b22..61b753c0c 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -579,6 +579,9 @@ pub struct Config { #[serde(default)] pub default_domain: Option, + + #[serde(default)] + pub default_workspace: Option, } impl_lua_conversion!(Config); diff --git a/docs/changelog.md b/docs/changelog.md index 8e4c367c2..6df1e5670 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -22,7 +22,7 @@ As features stabilize some brief notes about them will accumulate here. * `Symbols Nerd Font Mono` is now bundled with WezTerm and is included as a default fallback font. This means that you may use any of the glyphs available in the [Nerd Fonts](https://github.com/ryanoasis/nerd-fonts) collection with any font without patching fonts and without explicitly adding that font to your fallback list. Pomicons have an unclear license for distribution and are excluded from this bundled font, however, you may manually install the font with those icons from the Nerd Font site itself and it will take precedence over the bundled font. This font replaces the older `PowerlineExtraSymbols` font. [#1521](https://github.com/wez/wezterm/issues/1521). * [wezterm.nerdfonts](config/lua/wezterm/nerdfonts.md) as a convenient way to resolve Nerd Fonts glyphs by name in your config file * [ShowLauncherArgs](config/lua/keyassignment/ShowLauncherArgs.md) key assignment to show the launcher scoped to certain items, or to launch it directly in fuzzy matching mode -* Workspaces. Follow work in progress on [#1531](https://github.com/wez/wezterm/issues/1531) and [#1322](https://github.com/wez/wezterm/discussions/1322)! [window:active_workspace()](config/lua/window/active_workspace.md) +* Workspaces. Follow work in progress on [#1531](https://github.com/wez/wezterm/issues/1531) and [#1322](https://github.com/wez/wezterm/discussions/1322)! [window:active_workspace()](config/lua/window/active_workspace.md) [default_workspace](config/lua/config/default_workspace.md) #### Changed diff --git a/docs/config/lua/config/default_workspace.md b/docs/config/lua/config/default_workspace.md new file mode 100644 index 000000000..b495c0f0a --- /dev/null +++ b/docs/config/lua/config/default_workspace.md @@ -0,0 +1,6 @@ +# `default_workspace = "default"` + +*Since: nightly builds only* + +Specifies the name of the default workspace. +The default is `"default"`. diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs index 518982805..f22b717f6 100644 --- a/wezterm-gui/src/main.rs +++ b/wezterm-gui/src/main.rs @@ -452,7 +452,12 @@ impl Publish { command, command_dir: None, size: config.initial_size(), - workspace: workspace.unwrap_or(mux::DEFAULT_WORKSPACE).to_string(), + workspace: workspace.unwrap_or( + config + .default_workspace + .as_deref() + .unwrap_or(mux::DEFAULT_WORKSPACE) + ).to_string(), }) .await })); @@ -525,7 +530,14 @@ fn setup_mux( let client_id = Arc::new(mux::client::ClientId::new()); mux.register_client(client_id.clone()); mux.replace_identity(Some(client_id)); - mux.set_active_workspace(default_workspace_name.unwrap_or(mux::DEFAULT_WORKSPACE)); + mux.set_active_workspace( + default_workspace_name.unwrap_or( + config + .default_workspace + .as_deref() + .unwrap_or(mux::DEFAULT_WORKSPACE), + ), + ); crate::update::load_last_release_info_and_set_banner(); update_mux_domains(config)?;