Gtk.Widget.prototype.get_screen

function get_screen():Gdk.Screen {
    // Gjs wrapper for gtk_widget_get_screen()
}

Get the Gdk.Screen from the toplevel window associated with this widget. This function can only be called after the widget has been added to a widget hierarchy with a Gtk.Window at the top.

In general, you should only create screen specific resources when a widget has been realized, and you should free those resources when the widget is unrealized.

Since 2.2

Returns

the Gdk.Screen for the toplevel for this widget.