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.
34 lines
950 B
Rust
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,
|
|
);
|
|
}
|
|
}
|