Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

1.3 KB
Raw Blame

gui-attached

{{since('20230320-124340-559cb7b0')}}

This event is triggered when the GUI is starting up after attaching the selected domain. For example, when you use wezterm connect DOMAIN or wezterm start --domain DOMAIN to start the GUI, the gui-attached event will be triggered and passed the MuxDomain object associated with DOMAIN. In cases where you don't specify the domain, the default domain will be passed instead.

This event fires after the gui-startup event.

Note that the gui-startup event does not fire when invoking wezterm connect DOMAIN or wezterm start --domain DOMAIN --attach.

You can use this opportunity to take whatever action suits your purpose; some users like to maximize all of their windows on startup, and this event would allow you do that:

local wezterm = require 'wezterm'
local mux = wezterm.mux

wezterm.on('gui-attached', function(domain)
  -- maximize all displayed windows on startup
  local workspace = mux.get_active_workspace()
  for _, window in ipairs(mux.all_windows()) do
    if window:get_workspace() == workspace then
      window:gui_window():maximize()
    end
  end
end)

local config = wezterm.config_builder()

return config

See also: gui-startup.