mirror of
https://github.com/wez/wezterm.git
synced 2024-12-28 16:07:34 +03:00
Added initial_rows, initial_cols configuration
Allows specifying the size of new windows. Refs: https://github.com/wez/wezterm/issues/142
This commit is contained in:
parent
8f3a233773
commit
7d94aaa475
@ -10,7 +10,8 @@ daily) from the master branch. It may not be usable and
|
|||||||
the feature set may change. As features stabilize some
|
the feature set may change. As features stabilize some
|
||||||
brief notes about them may accumulate here.
|
brief notes about them may accumulate here.
|
||||||
|
|
||||||
* No notable changes yet!
|
* Added `initial_rows` and `initial_cols` config options to set the starting
|
||||||
|
size of new terminal windows
|
||||||
|
|
||||||
### 20200202-181957-765184e5
|
### 20200202-181957-765184e5
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ use crate::frontend::FrontEndSelection;
|
|||||||
use crate::keyassignment::KeyAssignment;
|
use crate::keyassignment::KeyAssignment;
|
||||||
use anyhow::{anyhow, bail, Context, Error};
|
use anyhow::{anyhow, bail, Context, Error};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use portable_pty::CommandBuilder;
|
use portable_pty::{CommandBuilder, PtySize};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std;
|
use std;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -300,6 +300,14 @@ pub struct Config {
|
|||||||
/// as the positional arguments to that command.
|
/// as the positional arguments to that command.
|
||||||
pub default_prog: Option<Vec<String>>,
|
pub default_prog: Option<Vec<String>>,
|
||||||
|
|
||||||
|
/// Specifies the height of a new window, expressed in character cells.
|
||||||
|
#[serde(default = "default_initial_rows")]
|
||||||
|
pub initial_rows: u16,
|
||||||
|
|
||||||
|
/// Specifies the width of a new window, expressed in character cells
|
||||||
|
#[serde(default = "default_initial_cols")]
|
||||||
|
pub initial_cols: u16,
|
||||||
|
|
||||||
#[serde(default = "default_hyperlink_rules")]
|
#[serde(default = "default_hyperlink_rules")]
|
||||||
pub hyperlink_rules: Vec<hyperlink::Rule>,
|
pub hyperlink_rules: Vec<hyperlink::Rule>,
|
||||||
|
|
||||||
@ -756,6 +764,15 @@ impl Config {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn initial_size(&self) -> PtySize {
|
||||||
|
PtySize {
|
||||||
|
rows: self.initial_rows,
|
||||||
|
cols: self.initial_cols,
|
||||||
|
pixel_width: 0,
|
||||||
|
pixel_height: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build_prog(&self, prog: Option<Vec<&OsStr>>) -> Result<CommandBuilder, Error> {
|
pub fn build_prog(&self, prog: Option<Vec<&OsStr>>) -> Result<CommandBuilder, Error> {
|
||||||
let mut cmd = match prog {
|
let mut cmd = match prog {
|
||||||
Some(args) => {
|
Some(args) => {
|
||||||
@ -808,6 +825,14 @@ fn default_scrollback_lines() -> usize {
|
|||||||
3500
|
3500
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_initial_rows() -> u16 {
|
||||||
|
24
|
||||||
|
}
|
||||||
|
|
||||||
|
fn default_initial_cols() -> u16 {
|
||||||
|
80
|
||||||
|
}
|
||||||
|
|
||||||
fn default_hyperlink_rules() -> Vec<hyperlink::Rule> {
|
fn default_hyperlink_rules() -> Vec<hyperlink::Rule> {
|
||||||
vec![
|
vec![
|
||||||
// URL with a protocol
|
// URL with a protocol
|
||||||
|
@ -1224,11 +1224,12 @@ impl TermWindow {
|
|||||||
pub fn spawn_new_window(&mut self) {
|
pub fn spawn_new_window(&mut self) {
|
||||||
async fn new_window() -> anyhow::Result<()> {
|
async fn new_window() -> anyhow::Result<()> {
|
||||||
let mux = Mux::get().unwrap();
|
let mux = Mux::get().unwrap();
|
||||||
|
let config = crate::config::configuration();
|
||||||
let fonts = Rc::new(FontConfiguration::new());
|
let fonts = Rc::new(FontConfiguration::new());
|
||||||
let window_id = mux.new_empty_window();
|
let window_id = mux.new_empty_window();
|
||||||
let tab = mux
|
let tab = mux
|
||||||
.default_domain()
|
.default_domain()
|
||||||
.spawn(PtySize::default(), None, None, window_id)
|
.spawn(config.initial_size(), None, None, window_id)
|
||||||
.await?;
|
.await?;
|
||||||
let front_end = front_end().expect("to be called on gui thread");
|
let front_end = front_end().expect("to be called on gui thread");
|
||||||
front_end.spawn_new_window(&fonts, &tab, window_id)?;
|
front_end.spawn_new_window(&fonts, &tab, window_id)?;
|
||||||
|
@ -34,7 +34,6 @@ use crate::mux::Mux;
|
|||||||
use crate::server::client::{unix_connect_with_retry, Client};
|
use crate::server::client::{unix_connect_with_retry, Client};
|
||||||
use crate::server::domain::{ClientDomain, ClientDomainConfig};
|
use crate::server::domain::{ClientDomain, ClientDomainConfig};
|
||||||
use portable_pty::cmdbuilder::CommandBuilder;
|
use portable_pty::cmdbuilder::CommandBuilder;
|
||||||
use portable_pty::PtySize;
|
|
||||||
|
|
||||||
mod font;
|
mod font;
|
||||||
use crate::font::locator::FontLocatorSelection;
|
use crate::font::locator::FontLocatorSelection;
|
||||||
@ -366,7 +365,7 @@ async fn async_run_ssh(opts: SshCommand, params: SshParameters) -> anyhow::Resul
|
|||||||
|
|
||||||
let window_id = mux.new_empty_window();
|
let window_id = mux.new_empty_window();
|
||||||
let tab = domain
|
let tab = domain
|
||||||
.spawn(PtySize::default(), cmd, None, window_id)
|
.spawn(config.initial_size(), cmd, None, window_id)
|
||||||
.await?;
|
.await?;
|
||||||
let fontconfig = Rc::new(FontConfiguration::new());
|
let fontconfig = Rc::new(FontConfiguration::new());
|
||||||
gui.spawn_new_window(&fontconfig, &tab, window_id)?;
|
gui.spawn_new_window(&fontconfig, &tab, window_id)?;
|
||||||
@ -424,7 +423,7 @@ fn run_serial(config: config::ConfigHandle, opts: &SerialCommand) -> anyhow::Res
|
|||||||
block_on(domain.attach())?; // FIXME: blocking
|
block_on(domain.attach())?; // FIXME: blocking
|
||||||
|
|
||||||
let window_id = mux.new_empty_window();
|
let window_id = mux.new_empty_window();
|
||||||
let tab = block_on(domain.spawn(PtySize::default(), None, None, window_id))?; // FIXME: blocking
|
let tab = block_on(domain.spawn(config.initial_size(), None, None, window_id))?; // FIXME: blocking
|
||||||
gui.spawn_new_window(&fontconfig, &tab, window_id)?;
|
gui.spawn_new_window(&fontconfig, &tab, window_id)?;
|
||||||
|
|
||||||
maybe_show_configuration_error_window();
|
maybe_show_configuration_error_window();
|
||||||
@ -499,10 +498,11 @@ async fn spawn_tab_in_default_domain_if_mux_is_empty(
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let config = config::configuration();
|
||||||
let window_id = mux.new_empty_window();
|
let window_id = mux.new_empty_window();
|
||||||
let tab = mux
|
let tab = mux
|
||||||
.default_domain()
|
.default_domain()
|
||||||
.spawn(PtySize::default(), cmd, None, window_id)
|
.spawn(config.initial_size(), cmd, None, window_id)
|
||||||
.await?;
|
.await?;
|
||||||
let fontconfig = Rc::new(FontConfiguration::new());
|
let fontconfig = Rc::new(FontConfiguration::new());
|
||||||
front_end()
|
front_end()
|
||||||
|
Loading…
Reference in New Issue
Block a user