public void list_top_level () {
    // query all top-level windows
    for (Window child : display.default_root.tree ().children ()) {

      // selection criteria
      Window.AttributesReply atts = child.attributes ();
      String name = child.wm_name ();
      if (! atts.override_redirect ()
          && atts.map_state () == Window.AttributesReply.VIEWABLE
	  && name != null) {

        System.out.println (child.id + " " + name);

      }
    }
  }