1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-28 16:07:34 +03:00
wezterm/docs/config/lua/window-events/user-var-changed.md
2023-03-20 22:54:27 -07:00

31 lines
699 B
Markdown

# `user-var-changed`
{{since('20220903-194523-3bb1ed61')}}
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:
```bash
printf "\033]1337;SetUserVar=%s=%s\007" foo `echo -n bar | base64`
```
to set the user var named `foo` to the value `bar`.
Then, if you have this in your config:
```lua
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()](../pane/get_user_vars.md).