added toggle func for transparent background
This commit is contained in:
23
wezterm.lua
23
wezterm.lua
@@ -23,6 +23,7 @@ config.initial_rows = 32
|
|||||||
config.initial_cols = 129
|
config.initial_cols = 129
|
||||||
|
|
||||||
--tansparent
|
--tansparent
|
||||||
|
local is_transparent = true
|
||||||
config.window_background_opacity = 0.8
|
config.window_background_opacity = 0.8
|
||||||
config.text_background_opacity = 0.2
|
config.text_background_opacity = 0.2
|
||||||
|
|
||||||
@@ -32,6 +33,28 @@ config.keys = {
|
|||||||
{ key = "l", mods = "ALT", action = act.ActivateTabRelative(1) },
|
{ key = "l", mods = "ALT", action = act.ActivateTabRelative(1) },
|
||||||
{ key = "h", mods = "ALT", action = act.ActivateTabRelative(-1) },
|
{ key = "h", mods = "ALT", action = act.ActivateTabRelative(-1) },
|
||||||
{ key = "f", mods = "ALT", action = act.ToggleFullScreen },
|
{ key = "f", mods = "ALT", action = act.ToggleFullScreen },
|
||||||
|
-- Keybinding to toggle transparency
|
||||||
|
{
|
||||||
|
key = "o",
|
||||||
|
mods = "ALT|CTRL",
|
||||||
|
action = wezterm.action_callback(function(window)
|
||||||
|
if is_transparent then
|
||||||
|
-- Set to solid
|
||||||
|
window:set_config_overrides({
|
||||||
|
window_background_opacity = 1.0,
|
||||||
|
text_background_opacity = 1.0,
|
||||||
|
})
|
||||||
|
is_transparent = false
|
||||||
|
else
|
||||||
|
-- Set to transparent
|
||||||
|
window:set_config_overrides({
|
||||||
|
window_background_opacity = 0.8,
|
||||||
|
text_background_opacity = 0.2,
|
||||||
|
})
|
||||||
|
is_transparent = true
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|||||||
Reference in New Issue
Block a user