Gtk.Widget.prototype.is_toplevel

function is_toplevel():Boolean {
    // Gjs wrapper for gtk_widget_is_toplevel()
}

Determines whether widget is a toplevel widget.

Currently only Gtk.Window and Gtk.Invisible (and out-of-process #GtkPlugs) are toplevel widgets. Toplevel widgets have no parent widget.

Since 2.18

Returns

true if widget is a toplevel, false otherwise