Understand why xdotool/wmctrl scripts stop working under Wayland and choose a compositor-appropriate replacement

domain: github.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Recognize that xdotool and wmctrl only speak the X11 protocol; Wayland's security model doesn't expose equivalent global input-injection and window-query APIs, so these tools don't work natively there
  2. For XWayland-bridged apps (non-native Wayland clients), xdotool can sometimes still target that specific app, but it cannot see or control native Wayland windows generally, and wmctrl also misses windows on Wayland
  3. For input injection under Wayland, use ydotool, which emulates input via the kernel's uinput framework instead of talking to a display server, keeping in mind it can't target/focus a specific background window like xdotool and types more slowly
  4. For window management (move/resize/list) under wlroots-based compositors, use wlrctl, which depends on the compositor supporting the wlr-foreign-toplevel-management protocol
  5. For GNOME or KDE specifically, expect to need a compositor-specific tool, since there is no single cross-compositor equivalent of wmctrl on Wayland

Known gotchas

Related routes

Explain why an xdotool/wmctrl automation script fails when run under a Wayland session
wayland.freedesktop.org · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans