{"record":{"id":"6ea89bff49f80ba8","repo":"wezterm/wezterm","slug":"active-window-is-not-in-any-screen","errorCode":null,"errorMessage":"active window is not in any screen","messagePattern":"active window is not in any screen","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"window/src/os/x11/connection.rs","lineNumber":1053,"sourceCode":"                src_y: 0,\n            })\n            .context(\"querying root coordinates\")?;\n        let window_rect: ScreenRect = euclid::rect(\n            trans_geom.dst_x().into(),\n            trans_geom.dst_y().into(),\n            geom.width() as isize,\n            geom.height() as isize,\n        );\n        Ok(by_name\n            .values()\n            .filter_map(|screen| {\n                screen\n                    .rect\n                    .intersection(&window_rect)\n                    .map(|r| (screen, r.area()))\n            })\n            .max_by_key(|s| s.1)\n            .ok_or_else(|| anyhow::anyhow!(\"active window is not in any screen\"))?\n            .0\n            .clone())\n    }\n}\n","sourceCodeStart":1035,"sourceCodeEnd":1058,"githubUrl":"https://github.com/wezterm/wezterm/blob/3ff7522b9617ec920f7fbdb22b57e93d42d93ee9/window/src/os/x11/connection.rs#L1035-L1058","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before: broken layout leaves the active window off every output\nxrandr --output eDP-1 --auto --output HDMI-1 --off\n# after: contiguous tiling, then restart wezterm\nxrandr --output eDP-1 --auto --primary --output HDMI-1 --auto --right-of eDP-1","handlingStrategy":"fallback","validationCode":"# quick triage: compare window geometry against connected outputs\nxdotool getactivewindow getwindowgeometry\nxrandr | grep ' connected'","typeGuard":null,"tryCatchPattern":"// embedders: degrade to the primary screen when lookup fails\nlet screen = current_screen(&conn).unwrap_or_else(|_| primary_screen(&conn));","preventionTips":["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"],"tags":["x11","xrandr","multi-monitor","wezterm"],"backgroundTag":"x11-screen-not-found","analyzedSha":"3ff7522b9617ec920f7fbdb22b57e93d42d93ee9","analyzedAt":"2026-08-20T04:47:31.434Z","contentChangedAt":"2026-08-20T04:47:31.434Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}