-
|
Is it possible, to change the font size of an existing wezterm instance via the CLI? This would enable integration similar to this one. The idea there is that when you enter "zen mode" (a focus reading mode plugin for Neovim), the font size of Kitty (in that particular example) gets increased (decreased upon leaving that mode). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
I would suggest using a user var named something like ZEN_MODE. You can set it using something like: printf "\033]1337;SetUserVar=%s=%s\007" ZEN_MODE `echo -n on | base64`or turn it off: printf "\033]1337;SetUserVar=%s=%s\007" ZEN_MODE `echo -n off | base64`In your config, you can handle the zen mode changing using something like this: local wezterm = require 'wezterm'
wezterm.on('user-var-changed', function(window, pane, name, value)
local overrides = window:get_config_overrides() or {}
if name == "ZEN_MODE" then
if value == "on" then
overrides.font_size = 18
else
overrides.font_size = nil
end
end
window:set_config_overrides(overrides)
end)
return {}There are some caveats with this:
An alternative implementation might be something like this, which allows you to use the existing/default local wezterm = require 'wezterm'
wezterm.on('user-var-changed', function(window, pane, name, value)
if name == "ZEN_MODE" then
if value == "on" then
-- Each IncreaseFontSize will increase by 10%, so if you want it 20% bigger,
-- call this twice.
window:perform_action(wezterm.action.IncreaseFontSize, pane)
end
end
end)
return {}See: https://wezfurlong.org/wezterm/config/lua/window-events/user-var-changed.html |
Beta Was this translation helpful? Give feedback.
I would suggest using a user var named something like ZEN_MODE.
You can set it using something like:
or turn it off:
In your config, you can handle the zen mode changing using something like this: