Window-manager / xmonad in OCaml?

Is there a minimalist window manager scriptable in OCaml ?

I’m currently using XMonad/Haskell, and I’m wondering if there is a way to swap this for something OCaml based.

In particular, I need something which does the following:

  • maintain a list of running processes
  • for each process, maintain a list of “windows” open in X11
  • maintains a list of desktops, w/ an active desktop
  • each Desktop has a list of “rects” (mapped to ‘window’ from earlier)

Then, I want the OCaml to iitercept all key / mouse events and decide to whether:
(1) interpret it itself or
(2) pass it to some running process


Not sure if it fits all your requirements, but I recall that there was a project on verifying xmonad in Coq ( — while that project involved extracting the verified Coq/Gallina code to Haskell, I guess you could also try and extract it to OCaml, although ymmv.

To my knowledge, this doesn’t really exist at the moment (there was GwML at some point, but I don’t think it is maintained anymore; I haven’t tried it either).
I also think it would be really cool to have an OCaml-based WM / WM toolkit. In fact, trying to build something like this has been a side-project of mine for many years, but I’ve mostly been toying with various designs and don’t have anything to show for it currently. I’ve picked it up again recently (as a wayland compositor based on wlroots/dwl), but I wouldn’t hold my breath…


Maybe you can draw some inspiration from Spatial Shell.