mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 23:21:08 +03:00
Add status_update_interval option for status updates
The status event is triggered at window creation, and then every `status_update_interval` milliseconds. refs: https://github.com/wez/wezterm/issues/500
This commit is contained in:
parent
ff8bda29e3
commit
9ac230876c
@ -1039,9 +1039,16 @@ pub struct Config {
|
||||
|
||||
#[serde(default = "default_alternate_buffer_wheel_scroll_speed")]
|
||||
pub alternate_buffer_wheel_scroll_speed: u8,
|
||||
|
||||
#[serde(default = "default_status_update_interval")]
|
||||
pub status_update_interval: u64,
|
||||
}
|
||||
impl_lua_conversion!(Config);
|
||||
|
||||
fn default_status_update_interval() -> u64 {
|
||||
1_000
|
||||
}
|
||||
|
||||
fn default_alternate_buffer_wheel_scroll_speed() -> u8 {
|
||||
3
|
||||
}
|
||||
|
@ -519,9 +519,28 @@ impl TermWindow {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger an initial status update
|
||||
{
|
||||
let window = window.clone();
|
||||
promise::spawn::spawn(async move {
|
||||
window
|
||||
.apply(move |tw, ops| {
|
||||
if let Some(term_window) = tw.downcast_mut::<TermWindow>() {
|
||||
term_window.emit_status_event(ops)?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
let interval = configuration().status_update_interval;
|
||||
let interval = std::time::Duration::from_millis(interval);
|
||||
Connection::get()
|
||||
.unwrap()
|
||||
.schedule_timer(std::time::Duration::from_secs(1), move || {
|
||||
.schedule_timer(interval, move || {
|
||||
window.apply(move |myself, window| {
|
||||
if let Some(myself) = myself.downcast_mut::<Self>() {
|
||||
myself.emit_status_event(window)?;
|
||||
|
Loading…
Reference in New Issue
Block a user