kovidgoyal/kitty · warning

Wayland: Did not get activation token from compositor. Use a

Error message

Wayland: Did not get activation token from compositor. Use a better compositor.

What it means

When kitty asks the Wayland compositor for an xdg-activation token (needed to focus a window without focus-stealing prevention blocking it), the compositor returned an empty or missing token. The callback still fires with an empty string, so the activation request is simply ineffective rather than fatal.

Source

Thrown at kitty/glfw.c:2805

    OSWindow *w = os_window_for_id(os_window_id);
    if (w && w->handle) glfwRequestWindowAttention(w->handle);
    Py_RETURN_NONE;
}


static PyObject *
get_content_scale_for_window(PYNOARG) {
    OSWindow *w = global_state.callback_os_window ? global_state.callback_os_window : global_state.os_windows;
    float xscale, yscale;
    glfwGetWindowContentScale(w->handle, &xscale, &yscale);
    return Py_BuildValue("ff", xscale, yscale);
}

static void
activation_token_callback(GLFWwindow *window UNUSED, const char *token, void *data) {
    if (!token || !token[0]) {
        token = "";
        log_error("Wayland: Did not get activation token from compositor. Use a better compositor.");
    }
    PyObject *ret = PyObject_CallFunction(data, "s", token);
    if (ret == NULL) PyErr_Print();
    else Py_DECREF(ret);
    Py_CLEAR(data);
}

void
run_with_activation_token_in_os_window(OSWindow *w, PyObject *callback) {
    if (global_state.is_wayland) {
        Py_INCREF(callback);
        glfwWaylandRunWithActivationToken(w->handle, activation_token_callback, callback);
    }
}

static PyObject *
toggle_fullscreen(PyObject UNUSED *self, PyObject *args) {
    id_type os_window_id = 0;

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Upgrade to a compositor implementing xdg_activation_v1 (recent sway, labwc, KDE, GNOME)
  2. Use the compositor's own focusing mechanism (swaymsg focus, wmctrl equivalent) instead of relying on kitty's activation
  3. Check protocol support: wayland-info | grep xdg_activation
  4. If you control the flow, ignore the error — the token is empty and activation is skipped

Example fix

# before
kitty @ focus-window
# after (sway)
swaymsg '[app_id="kitty"] focus'
Defensive patterns

Strategy: fallback

Validate before calling

wayland-info | grep -q xdg_activation_v1 || echo 'focus-window may be a no-op; use swaymsg/wmctrl-style focusing'

Prevention

When it happens

Trigger: Calling a kitty remote-control or focus API that requests window activation (e.g. kitty @ focus-window, set-window-title focus, or dbus activation) on a Wayland compositor that does not implement xdg_activation_v1 (wlroots-older versions, some minimal compositors).

Common situations: Using kitty @ focus-window under older sway/weston versions or compositors lacking the xdg-activation protocol; scripting kitty remote control on Wayland; version upgrades where the protocol support regressed or is absent.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/4fc21c805683ea4a. Report an issue: GitHub.