Is there a way to close a Relm4 gtk window when it loses focus (e.g. user clicks away)?

76 views Asked by At

I have a window like this:

view! {
        gtk::Window {
            set_title: Some("Runner"),
            set_default_width: 600,
            set_default_height: 280,
            set_decorated: false,
        }
}

And I would like to close the application window (fully exit the application) when the user clicks away from the window.

I have tried connect_has_focus_notify[sender] => move |_window| {} and connect_move_focus[sender] => move |_window| {}, but these events don't seem to be fired when the window loses focus (I click away). I'm sorry if this isn't enough information, I'm quite new to both rust and GTK so I still have some difficulity with the documentation.

0

There are 0 answers