There are currently four types of nodes in the frame tree. You can check the :type
property of a node to determine its type:
(case (in node :type)
# A managed window, which has no children
:window
...
# A frame, which contains windows or other frames
:frame
...
# A virtual desktop, which contains top-level frames (monitors)
:layout
...
# The root of the frame tree, which contains layouts (virtual desktops)
:virtual-desktop-container
...
)
There's no monitor type though. In Jwno, a monitor is just a special :frame
, called a top-level frame. You can check a frame node's :monitor
property to see if it's a monitor:
(if-let [monitor (in node :monitor)]
(do
# It's a monitor
)
(do
# It's a normal frame otherwise
)
)
For all types of tree nodes, their supported methods can be inspected by peeking inside their prototypes:
(keys (table/proto-flatten node))