diff --git a/wezterm/variables.lua b/wezterm/variables.lua new file mode 100644 index 0000000..91c425f --- /dev/null +++ b/wezterm/variables.lua @@ -0,0 +1,26 @@ +local variables = {} + +variables.callbacks = {} + +function variables.callbacks.bgcolor(window, _, color) + local overrides = window:get_config_overrides() or {} + + if color ~= "" then + overrides.colors = { background = color } + else + overrides.colors = nil + end + + window:set_config_overrides(overrides) +end + +function variables.listen() + local wezterm = require "wezterm" + wezterm.on("user-var-changed", function(window,pane,name,value) + if variables.callbacks[name] then + return variables.callbacks[name](window, pane, value) + end + end) +end + +return variables