WADA-DEV(7) $ /en/blog/waybar-atspi-click-noop/

NAME

waybar-atspi-click-noop — I Had Claude Code Check My Waybar Fix: AT-SPI Could See the Button but Not Press It

SYNOPSIS

I fixed Waybar by moving to the git version and tried to have Claude Code check the fix too. I learned the desktop has an accessibility tree separate from what is drawn, but Waybar's buttons could not be pressed through it.

DESCRIPTION

I tried to have Claude Code check that a Waybar fix had worked, not just apply it. That is how I learned the desktop has a way to read the UI apart from the screen: the accessibility tree. Waybar’s workspace buttons could not be pressed through it, though. In the end I pressed them myself.

Waybar, left alone

Waybar had bothered me for a while. Clicking a workspace button did not switch workspaces, and the Wi-Fi access point I was connected to showed wrong. I knew, and left it.

Then I felt like fixing it. I had Claude Code look at upstream: a PR that fixes the workspace commands for Hyprland’s Lua config (#5013) had been merged. So I had it build waybar-git from the AUR and swap it in.

Having Claude Code check the fix

With the git version in, the next step was checking that it worked. I wondered if Claude Code could do that too: press a button and see whether the workspace switches.

Without taking a screenshot, Claude Code walked at-spi2-core’s accessibility tree over D-Bus and listed Waybar’s buttons and labels.

I didn’t know this existed. Given the idea of separating the API from the view, maybe it’s obvious, but I hadn’t thought the desktop worked that way too. I learned something.

Visible, but it won’t press

If it can see the button, it can press it, I thought, and had it run the AT-SPI Click action on a workspace button. Nothing switched. No error either.

I had Claude Code read Waybar’s src/modules/hyprland/workspace.cpp. The button is built like this:

m_button.add_events(Gdk::BUTTON_PRESS_MASK);
...
m_button.signal_button_press_event().connect(sigc::mem_fun(*this, &Workspace::handleClicked),
false);

The switch itself, handleClicked, runs only from a mouse button press event. Claude Code’s explanation was that AT-SPI’s Click does not raise that event, so it misses. I haven’t checked this myself, and the code it read is today’s upstream, which may differ from the revision I built.

I pressed it myself

I did the check by hand. The workspaces switched, and the Wi-Fi access point now showed correctly.

The check didn’t get automated. Still, finding out that there is an API behind the screen that reads the UI was worth it.

COMMENTS