From 4001452329051eeef40f88bc4e960c9e361b7100 Mon Sep 17 00:00:00 2001 From: Daveanand Mannie Date: Sat, 14 Sep 2024 09:23:43 -0400 Subject: [PATCH] added toggle func for transparent background --- wezterm.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/wezterm.lua b/wezterm.lua index 60f0cda..f655d4e 100644 --- a/wezterm.lua +++ b/wezterm.lua @@ -23,6 +23,7 @@ config.initial_rows = 32 config.initial_cols = 129 --tansparent +local is_transparent = true config.window_background_opacity = 0.8 config.text_background_opacity = 0.2 @@ -32,6 +33,28 @@ config.keys = { { key = "l", mods = "ALT", action = act.ActivateTabRelative(1) }, { key = "h", mods = "ALT", action = act.ActivateTabRelative(-1) }, { 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