user-var-changed
¶
Since: Version 20220903-194523-3bb1ed61
The functionality described in this section requires version 20220903-194523-3bb1ed61 of wezterm, or a more recent version.
The user-var-changed
event is emitted when a user var escape sequence is
used to set a user var.
You can use something like the following from your shell:
to set the user var named foo
to the value bar
.
Note
On some systems the base64
command wraps the output by default after some
amount of characters limiting the maximum length of the value. If this is
the case an argument like -w 0
might help to avoid wrapping.
Then, if you have this in your config:
local wezterm = require 'wezterm'
wezterm.on('user-var-changed', function(window, pane, name, value)
wezterm.log_info('var', name, value)
end)
return {}
your event handler will be called with name = 'foo'
and value = 'bar'
.
See also pane:get_user_vars().