I'm using the gtk4-layer-shell rust bindings and want to position my window on a specific monitor.
I have the following code:
let monitors: gio::ListModel = gdk::Display::default().unwrap().monitors();
let monitor: glib::Object = monitors.item(0).unwrap();
Thus I get the monitor as a glib::Object
. But gtk4-layer-shell expects a gdk::Monitor
to passed to window.set_monitor
. I don't know how to work further with the glib::Object
.
Libraries used: gtk4-rs, gdk4, gtk4-layer-shell.
You can use monitor.downcast::<gdk::Monitor>()
to convert a glib::Object
instance into a gdk::Monitor
.