wezterm/wezterm · error · anyhow::Error
active window is not in any screen
Error message
active window is not in any screen
What it means
The X11 connection tracks RANDR screen rectangles; this lookup picks the screen owning the currently focused window by intersecting the window's rectangle with each screen rect and keeping the largest overlap. If the active window's geometry intersects no known screen, max_by_key finds nothing and this error is raised.
Source
Thrown at window/src/os/x11/connection.rs:1053
src_y: 0,
})
.context("querying root coordinates")?;
let window_rect: ScreenRect = euclid::rect(
trans_geom.dst_x().into(),
trans_geom.dst_y().into(),
geom.width() as isize,
geom.height() as isize,
);
Ok(by_name
.values()
.filter_map(|screen| {
screen
.rect
.intersection(&window_rect)
.map(|r| (screen, r.area()))
})
.max_by_key(|s| s.1)
.ok_or_else(|| anyhow::anyhow!("active window is not in any screen"))?
.0
.clone())
}
}
View on GitHub (pinned to 3ff7522b96)
Solutions
- Run `xrandr` and reposition outputs so they tile sensibly with no orphaned regions
- Restart wezterm after changing display layout so screen state is re-read
- Pull the stray window back: `wmctrl -r :ACTIVE: -e 0,0,0,-1,-1`
- Update wezterm; screen tracking around RANDR changes has seen multiple upstream fixes
Example fix
# before: broken layout leaves the active window off every output xrandr --output eDP-1 --auto --output HDMI-1 --off # after: contiguous tiling, then restart wezterm xrandr --output eDP-1 --auto --primary --output HDMI-1 --auto --right-of eDP-1
Defensive patterns
Strategy: fallback
Validate before calling
# quick triage: compare window geometry against connected outputs xdotool getactivewindow getwindowgeometry xrandr | grep ' connected'
Try / catch
// embedders: degrade to the primary screen when lookup fails let screen = current_screen(&conn).unwrap_or_else(|_| primary_screen(&conn));
Prevention
- Use contiguous xrandr layouts (relative positions) rather than absolute gaps
- Restart wezterm after docking/undocking or layout changes
- Keep wezterm current; RANDR edge cases are actively fixed
When it happens
Trigger: The focused window's x/y/width/height lies entirely outside every RANDR CRTC rectangle: stale screen layout after an output was unplugged, xrandr scripts leaving gaps or stranding coordinates, or a window sitting on a removed output.
Common situations: Laptop docking/undocking; display layout changes while windows keep old geometry; VNC or nested X servers reporting odd layouts; window managers that park windows offscreen.
Related errors
- XRANDR is not available, cannot query screen geometry
- window is not in any screen
- empty list of windows
- problem with new keymap
- problem with new state
AI-assisted analysis of wezterm/wezterm@3ff7522b96 (2026-08-20).
Data as JSON: /api/errors/6ea89bff49f80ba8.
Report an issue: GitHub.