# GimpUi.widget_track_monitor

    function widget_track_monitor(widget: Gtk.Widget, monitor_changed_callback: GObject.Callback): void {
        // Gjs wrapper for gimp_widget_track_monitor()
    }

This function behaves as if Gtk.Widget had a signal

GtkWidget::monitor_changed(GtkWidget *widget, gpointer user_data)

That is emitted whenever widget's toplevel window is moved from one monitor to another. This function automatically connects to the right toplevel Gtk.Window, even across moving widget between toplevel windows.

Note that this function tracks the toplevel, not widget itself, so all a window's widgets are always considered to be on the same monitor. This is because this function is mainly used for fetching the new monitor's color profile, and it makes little sense to use different profiles for the widgets of one window.

Since 2.10

widget

  a Gtk.Widget

monitor_changed_callback

  the callback when widget's monitor changes