From 130645414ddcb5e40e27a13e77a0ecbb508ef788 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 10 Aug 2022 06:10:25 -0700 Subject: [PATCH] add update-status event. deprecates update-right-status refs: #1561 --- docs/changelog.md | 1 + .../lua/window-events/update-right-status.md | 6 +++++ .../config/lua/window-events/update-status.md | 25 +++++++++++++++++++ wezterm-gui/src/termwindow/mod.rs | 1 + 4 files changed, 33 insertions(+) create mode 100644 docs/config/lua/window-events/update-status.md diff --git a/docs/changelog.md b/docs/changelog.md index ba4770cc0..bb42d2f47 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -18,6 +18,7 @@ As features stabilize some brief notes about them will accumulate here. #### Changed * [ActivatePaneDirection](config/lua/keyassignment/ActivatePaneDirection.md) now uses recency to resolve ambiguous moves [#2374](https://github.com/wez/wezterm/issues/2374) +* [update-status](config/lua/window-events/update-status.md) is a more general event for updating left or right status. `update-right-status` is considered to be deprecated in favor of `update-status`. #### Fixed diff --git a/docs/config/lua/window-events/update-right-status.md b/docs/config/lua/window-events/update-right-status.md index 858acaf02..bd0bcc0f0 100644 --- a/docs/config/lua/window-events/update-right-status.md +++ b/docs/config/lua/window-events/update-right-status.md @@ -22,3 +22,9 @@ if the hook takes longer than the `wezterm` won't schedule another call until `status_update_interval` milliseconds have elapsed since the last call completed. +*Since: nightly builds only* + +This event is considered to be deprecated and you should migrate +to using [update-status](update-status.md), which behaves the +same way, but doesn't overly focus on the right status area. + diff --git a/docs/config/lua/window-events/update-status.md b/docs/config/lua/window-events/update-status.md new file mode 100644 index 000000000..480df0a8e --- /dev/null +++ b/docs/config/lua/window-events/update-status.md @@ -0,0 +1,25 @@ +# `update-status` + +*Since: nightly builds only* + +The `update-status` event is emitted periodically (based on the +interval specified by the [status_update_interval](../config/status_update_interval.md) +configuration value). + +There is no defined return value for the event, but its purpose is to allow +you the chance to carry out some activity and then ultimately call +[window:set_right_status](../window/set_right_status.md) or [window:set_left_status](../window/set_left_status.md). + +The first event parameter is a [`window` object](../window/index.md) that +represents the gui window. + +The second event parameter is a [`pane` object](../pane/index.md) that +represents the active pane in that window. + +`wezterm` will ensure that only a single instance of this event is outstanding; +if the hook takes longer than the +[status_update_interval](../config/status_update_interval.md) to complete, +`wezterm` won't schedule another call until `status_update_interval` +milliseconds have elapsed since the last call completed. + + diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index 40f0e7980..b6d41bda6 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -1265,6 +1265,7 @@ impl TermWindow { fn emit_status_event(&mut self) { self.emit_window_event("update-right-status", None); + self.emit_window_event("update-status", None); } fn schedule_window_event(&mut self, name: &str, pane_id: Option) {