Files
LLeMbas-TTY/wezterm-gui/src/termwindow/spawn.rs
T
Wez Furlong 4b3660d166 macos: allow running when there are no windows
Most of this commit is refactoring the spawn logic so that we
can reuse most of it to handle spawn requests when there is
no GUI window.
2022-12-21 00:31:58 -07:00

34 lines
950 B
Rust

use crate::spawn::SpawnWhere;
use config::keyassignment::{SpawnCommand, SpawnTabDomain};
use config::TermConfig;
use std::sync::Arc;
impl super::TermWindow {
pub fn spawn_command(&self, spawn: &SpawnCommand, spawn_where: SpawnWhere) {
let size = if spawn_where == SpawnWhere::NewWindow {
self.config.initial_size(self.dimensions.dpi as u32)
} else {
self.terminal_size
};
let term_config = Arc::new(TermConfig::with_config(self.config.clone()));
crate::spawn::spawn_command_impl(
spawn,
spawn_where,
size,
Some(self.mux_window_id),
term_config,
)
}
pub fn spawn_tab(&mut self, domain: &SpawnTabDomain) {
self.spawn_command(
&SpawnCommand {
domain: domain.clone(),
..Default::default()
},
SpawnWhere::NewTab,
);
}
}