feat: wezterm theme switching

This commit is contained in:
WinterEkisha committed 2026-11-18 16:25:13 -08:00
1 parent 58ec82092c
commit a3a9472799
4 files changed
+88 -44

No files matched your search

+21 -13
View File
@@ -33,16 +33,32 @@
relativenumber = true;
};
# Define the global helper function so you can run :lua set_wezterm_theme('solid') anytime
extraConfigLua = ''
_G.set_wezterm_theme = function(theme)
local val = theme or ""
local b64 = vim.base64.encode(val)
local seq = string.format('\x1b]1337;SetUserVar=%s=%s\x07', 'WEZTERM_THEME', b64)
if vim.env.TMUX then
seq = string.format('\x1bPtmux;\x1b%s\x1b\\', seq)
end
pcall(vim.fn.chansend, vim.v.stderr, seq)
end
'';
autoGroups = {
WezTermUserVar = {
clear = true;
};
};
autoCmd = [
# --- Sets tab spacing for file types ---
{
event = [ "FileType" ];
pattern = [ "html" "css" "javascript" "typescript" "nix" "lua" ];
pattern = [ "html" "css" "javascript" "typescript" "nix" "lua" ];
callback = {
__raw = ''
function()
@@ -53,34 +69,26 @@
'';
};
}
# --- Set default WezTerm profile on entry/resume ---
{
event = [ "UIEnter" "VimResume" ];
group = "WezTermUserVar";
callback = {
__raw = ''
function()
local b64 = vim.base64.encode('true')
local seq = string.format('\x1b]1337;SetUserVar=%s=%s\x07', 'IS_NVIM', b64)
if vim.env.TMUX then
seq = string.format('\x1bPtmux;\x1b%s\x1b\\', seq)
end
pcall(vim.fn.chansend, vim.v.stderr, seq)
set_wezterm_theme('nvim')
end
'';
};
}
# --- Clear WezTerm profile (revert to base config) on exit/suspend ---
{
event = [ "VimLeavePre" "VimSuspend" ];
group = "WezTermUserVar";
callback = {
__raw = ''
function()
local b64 = vim.base64.encode('false')
local seq = string.format('\x1b]1337;SetUserVar=%s=%s\x07', 'IS_NVIM', b64)
if vim.env.TMUX then
seq = string.format('\x1bPtmux;\x1b%s\x1b\\', seq)
end
pcall(vim.fn.chansend, vim.v.stderr, seq)
set_wezterm_theme("")
end
'';
};