Skip to content

wezterm:is_focused()

Since: Version 20221119-145034-49b9839f

The functionality described in this section requires version 20221119-145034-49b9839f of wezterm, or a more recent version.

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 {}