pub fn close_when_requested(
    commands: Commands<'_, '_>,
    closed: EventReader<'_, '_, WindowCloseRequested>
)
Expand description

Close windows in response to WindowCloseRequested (e.g. when the close button is pressed).

This system is added by the WindowPlugin in the default configuration. To disable this behaviour, set close_when_requested (on the WindowPlugin) to false. Ensure that you read the caveats documented on that field if doing so.