Gtk.Window.prototype.get_focus

function get_focus():Gtk.Widget {
    // Gjs wrapper for gtk_window_get_focus()
}

Retrieves the current focused widget within the window. Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then <literal>gtk_widget_has_focus (widget)</literal> will not be true for the widget.

Returns

the currently focused widget, or null if there is none.