diff --git a/src/clients.rs b/src/clients.rs index d5997ca..ed85695 100644 --- a/src/clients.rs +++ b/src/clients.rs @@ -288,7 +288,7 @@ impl ClientState { .filter(move |&(k, _)| self.is_client_visible(k)) } - fn iter_all_clients(&self) -> impl Iterator { + pub fn iter_all_clients(&self) -> impl Iterator { self.floating_clients.iter().chain(self.clients.iter()) } diff --git a/src/state.rs b/src/state.rs index db6cc8a..357ebd1 100644 --- a/src/state.rs +++ b/src/state.rs @@ -30,6 +30,7 @@ pub struct WMConfig { num_virtualscreens: usize, mod_key: ModifierKey, gap: Option, + kill_clients_on_exit: bool, } pub struct WindowManager @@ -410,6 +411,13 @@ where } fn quit(&self) -> ! { + // TODO: should the window manager kill all clients on exit? probably + if self.config.kill_clients_on_exit { + self.clients + .iter_all_clients() + .for_each(|(&window, client)| self.backend.kill_window(window)); + } + info!("Goodbye."); std::process::exit(0); @@ -857,6 +865,7 @@ impl Default for WMConfig { num_virtualscreens: 10, mod_key: ModifierKey::Super, gap: Some(2), + kill_clients_on_exit: false, } } }