wezterm:is_focused()

Since: nightly builds only

Returns true if the window has focus.

The update-status event is fired when the focus state changes.

This example changes the color scheme based on the focus state:

local wezterm = require 'wezterm'

wezterm.on('update-status', function(window, pane)
  local overrides = window:get_config_overrides() or {}
  if window:is_focused() then
    overrides.color_scheme = 'nordfox'
  else
    overrides.color_scheme = 'nightfox'
  end
  window:set_config_overrides(overrides)
end)

return {}