Gtk.Widget.prototype.has_focus

function has_focus():Boolean {
    // Gjs wrapper for gtk_widget_has_focus()
}

Determines if the widget has the global input focus. See Gtk.is_focus for the difference between having the global input focus, and only having the focus within a toplevel.

Since 2.18

Returns

true if the widget has the global input focus.