Add wezterm variables script
This commit is contained in:
parent
d1b2eba724
commit
3fd1bf095f
1 changed files with 26 additions and 0 deletions
26
wezterm/variables.lua
Normal file
26
wezterm/variables.lua
Normal file
|
@ -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
|
Loading…
Reference in a new issue