1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

mux: update last input time for local pane actions

This commit updates the last input time for the active client
id when calling into local pane.  That time is visible in the
`wezterm cli list-clients` output.
This commit is contained in:
Wez Furlong 2022-01-15 07:03:20 -07:00
parent 9a241509a4
commit 324815b625
2 changed files with 11 additions and 0 deletions

View File

@ -337,6 +337,12 @@ impl Mux {
} }
} }
pub fn record_input_for_current_identity(&self) {
if let Some(ident) = self.identity.borrow().as_ref() {
self.client_had_input(ident);
}
}
pub fn register_client(&self, client_id: Arc<ClientId>) { pub fn register_client(&self, client_id: Arc<ClientId>) {
self.clients self.clients
.borrow_mut() .borrow_mut()

View File

@ -239,10 +239,12 @@ impl Pane for LocalPane {
} }
fn mouse_event(&self, event: MouseEvent) -> Result<(), Error> { fn mouse_event(&self, event: MouseEvent) -> Result<(), Error> {
Mux::get().unwrap().record_input_for_current_identity();
self.terminal.borrow_mut().mouse_event(event) self.terminal.borrow_mut().mouse_event(event)
} }
fn key_down(&self, key: KeyCode, mods: KeyModifiers) -> Result<(), Error> { fn key_down(&self, key: KeyCode, mods: KeyModifiers) -> Result<(), Error> {
Mux::get().unwrap().record_input_for_current_identity();
if self.tmux_domain.borrow().is_some() { if self.tmux_domain.borrow().is_some() {
log::error!("key: {:?}", key); log::error!("key: {:?}", key);
if key == KeyCode::Char('q') { if key == KeyCode::Char('q') {
@ -255,6 +257,7 @@ impl Pane for LocalPane {
} }
fn key_up(&self, key: KeyCode, mods: KeyModifiers) -> Result<(), Error> { fn key_up(&self, key: KeyCode, mods: KeyModifiers) -> Result<(), Error> {
Mux::get().unwrap().record_input_for_current_identity();
self.terminal.borrow_mut().key_up(key, mods) self.terminal.borrow_mut().key_up(key, mods)
} }
@ -270,6 +273,7 @@ impl Pane for LocalPane {
} }
fn writer(&self) -> RefMut<dyn std::io::Write> { fn writer(&self) -> RefMut<dyn std::io::Write> {
Mux::get().unwrap().record_input_for_current_identity();
self.pty.borrow_mut() self.pty.borrow_mut()
} }
@ -278,6 +282,7 @@ impl Pane for LocalPane {
} }
fn send_paste(&self, text: &str) -> Result<(), Error> { fn send_paste(&self, text: &str) -> Result<(), Error> {
Mux::get().unwrap().record_input_for_current_identity();
if self.tmux_domain.borrow().is_some() { if self.tmux_domain.borrow().is_some() {
Ok(()) Ok(())
} else { } else {