I’m remigrating to xmonad and wanted to set up a key in my config to perform global auto-type for keepass2. No problem, right? Something like this:

myKeymap = [
            -- ...
            , (prefix "a", spawn "/usr/bin/keepass2 --auto-type")

Well, it works on the xmonad side of things, because keepass responds with the error,

"For global auto-type, the 'xdotool' utility/package is required (version 2.20100818.3004 or higher!)"

Xdotool is installed, because which says so, and because global auto-type works fine in Unity.

After an hour or more of unsuccessful googling I decided to experiment with xdotool in the terminal and see what was happening.

> xdotool getactivewindow getwindowname
Your windowmanager claims not to support _NET_ACTIVE_WINDOW, so the attempt to query the active window aborted.
xdo_get_active_window reported an error

This finally gave me something more specific to search for, and the relevant package for the fix is XMonad.Hooks.EwmhDesktops. (Be aware that the current top search result has obsolete configuration instructions.)

All I had to do was add this

import XMonad.Hooks.EwmhDesktops

and then change the call to xmonad at the end to

main = xmonad $ ewmh myConfig

Moral of the story: it would have been really helpful if Keepass said something like, “xdotool was found, but it’s not returning the _NET_ACTIVE_WINDOW. Check your window manager.” Maybe that’s not possible for some reason specific to keepass or mono, but it’s a lesson to keep in mind when I’m writing my own code.