1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 21:32:13 +03:00

wezterm: allow connui size to be specified, make update ui taller

The release notes are generally slightly taller than the default
window size.
This commit is contained in:
Wez Furlong 2020-06-06 16:54:02 -07:00
parent bec7e36a09
commit 344543260e
2 changed files with 12 additions and 13 deletions

View File

@ -237,15 +237,20 @@ pub struct ConnectionUI {
impl ConnectionUI {
pub fn new() -> Self {
let enable_close_delay = true;
Self::with_dimensions(80, 24, enable_close_delay)
}
pub fn with_dimensions(width: usize, height: usize, enable_close_delay: bool) -> Self {
let (tx, rx) = bounded(16);
promise::spawn::spawn_into_main_thread(termwiztermtab::run(80, 24, move |term| {
promise::spawn::spawn_into_main_thread(termwiztermtab::run(width, height, move |term| {
let mut ui = ConnectionUIImpl { term, rx };
let status = ui.run().unwrap_or_else(|e| {
log::error!("while running ConnectionUI loop: {:?}", e);
CloseStatus::Implicit
});
if status == CloseStatus::Implicit {
if enable_close_delay && status == CloseStatus::Implicit {
ui.sleep(
"(this window will close automatically)",
Duration::new(120, 0),
@ -258,15 +263,8 @@ impl ConnectionUI {
}
pub fn new_with_no_close_delay() -> Self {
let (tx, rx) = bounded(16);
promise::spawn::spawn_into_main_thread(termwiztermtab::run(80, 24, move |term| {
let mut ui = ConnectionUIImpl { term, rx };
if let Err(e) = ui.run() {
log::error!("while running ConnectionUI loop: {:?}", e);
}
Ok(())
}));
Self { tx }
let enable_close_delay = false;
Self::with_dimensions(80, 24, enable_close_delay)
}
pub fn new_headless() -> Self {

View File

@ -146,7 +146,8 @@ lazy_static::lazy_static! {
fn show_update_available(release: Release) {
let mut updater = UPDATER_WINDOW.lock().unwrap();
let ui = ConnectionUI::new_with_no_close_delay();
let enable_close_delay = false;
let ui = ConnectionUI::with_dimensions(80, 35, enable_close_delay);
ui.title("WezTerm Update Available");
let install = if cfg!(windows) {
@ -177,7 +178,7 @@ fn show_update_available(release: Release) {
78,
termwiz::terminal::ScreenSize {
cols: 80,
rows: 24,
rows: 35,
xpixel: 0,
ypixel: 0,
},