docs/config/lua/pane/get_foreground_process_name.md
pane:get_foreground_process_name(){{since('20220101-133340-7edc5b5a')}}
Returns the path to the executable image for the pane.
This method has some restrictions and caveats:
ssh to connect to a remote host, you won't be able to access the name of the remote process that is running.If the path is not known then this method returns nil.
This example sets the right status to the executable path:
local wezterm = require 'wezterm'
-- Equivalent to POSIX basename(3)
-- Given "/foo/bar" returns "bar"
-- Given "c:\\foo\\bar" returns "bar"
function basename(s)
return string.gsub(s, '(.*[/\\])(.*)', '%2')
end
wezterm.on('update-right-status', function(window, pane)
window:set_right_status(basename(pane:get_foreground_process_name()))
end)
return {}
See also: get_foreground_process_info