expose the tty name associated with a pane

This commit is contained in:
Wez Furlong committed 2023-04-06 17:13:07 -07:00
1 parent 889390a448
commit 0ca050e09d
16 files changed
+126 -1

No files matched your search

+4
View File
@@ -126,3 +126,7 @@ end)
return config
```
{{since('nightly')}}
The `tty_name` field returns the tty name with the same constraints as described
in [pane:get_tty_name()](../pane/get_tty_name.md).
+27
View File
@@ -0,0 +1,27 @@
# `pane:get_tty_name()`
{{since('nightly')}}
Returns the tty device name, or `nil` if the name is unavailable.
* This information is only available for local panes. Multiplexer panes do not report this information. Similarly, if you are using eg: `ssh` to connect to a remote host, you won't be able to access the name of the remote process that is running.
* This information is only available on unix systems. Windows systems do not have an equivalent concept.
This example sets the right status to show the tty name:
```lua
local wezterm = require 'wezterm'
wezterm.on('update-status', function(window, pane)
local tty = pane:get_tty_name()
if tty then
window:set_right_status(tty)
else
window:set_right_status ''
end
end)
return {}
```