Gtk.Window.prototype.has_toplevel_focus

function has_toplevel_focus():Boolean {
    // Gjs wrapper for gtk_window_has_toplevel_focus()
}

Returns whether the input focus is within this GtkWindow. For real toplevel windows, this is identical to Gtk.is_active, but for embedded windows, like Gtk.Plug, the results will differ.

Since 2.4

Returns

true if the input focus is within this GtkWindow