config value for killing clients on exit

This commit is contained in:
Janis 2021-11-28 21:02:38 +01:00
parent 053afa576e
commit df3c2e33ce
2 changed files with 10 additions and 1 deletions

View file

@ -288,7 +288,7 @@ impl ClientState {
.filter(move |&(k, _)| self.is_client_visible(k)) .filter(move |&(k, _)| self.is_client_visible(k))
} }
fn iter_all_clients(&self) -> impl Iterator<Item = (&u64, &Client)> { pub fn iter_all_clients(&self) -> impl Iterator<Item = (&u64, &Client)> {
self.floating_clients.iter().chain(self.clients.iter()) self.floating_clients.iter().chain(self.clients.iter())
} }

View file

@ -30,6 +30,7 @@ pub struct WMConfig {
num_virtualscreens: usize, num_virtualscreens: usize,
mod_key: ModifierKey, mod_key: ModifierKey,
gap: Option<i32>, gap: Option<i32>,
kill_clients_on_exit: bool,
} }
pub struct WindowManager<B = XLib> pub struct WindowManager<B = XLib>
@ -410,6 +411,13 @@ where
} }
fn quit(&self) -> ! { 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."); info!("Goodbye.");
std::process::exit(0); std::process::exit(0);
@ -857,6 +865,7 @@ impl Default for WMConfig {
num_virtualscreens: 10, num_virtualscreens: 10,
mod_key: ModifierKey::Super, mod_key: ModifierKey::Super,
gap: Some(2), gap: Some(2),
kill_clients_on_exit: false,
} }
} }
} }