Stack package:xmonad

A stack is a cursor onto a window list. The data structure tracks focus by construction, and the master window is by convention the top-most item. Focus operations will not reorder the list that results from flattening the cursor. The structure can be envisaged as:
+-- master:  < '7' >
up |            [ '2' ]
+---------   [ '3' ]
focus:          < '4' >
dn +----------- [ '8' ]
A Stack can be viewed as a list with a hole punched in it to make the focused position. Under the zipper/calculus view of such structures, it is the differentiation of a [a], and integrating it back has a natural implementation used in index.
A cursor into a non-empty list of workspaces. We puncture the workspace list, producing a hole in the structure used to track the currently focused workspace. The two other lists that are produced are used to track those workspaces visible as Xinerama screens, and those workspaces not visible anywhere.
interface to the X11 library function XRestackWindows().