Add eww close-all
subcommand to close all running windows (#80)
* Add close-all command * Add close-all command * Re-add close-all using close_window method
This commit is contained in:
parent
f7d6bd4cb3
commit
58d57c4acd
2 changed files with 12 additions and 0 deletions
|
@ -29,6 +29,7 @@ pub enum EwwCommand {
|
||||||
window_name: WindowName,
|
window_name: WindowName,
|
||||||
},
|
},
|
||||||
KillServer,
|
KillServer,
|
||||||
|
CloseAll,
|
||||||
PrintState(crossbeam_channel::Sender<String>),
|
PrintState(crossbeam_channel::Sender<String>),
|
||||||
PrintDebug(crossbeam_channel::Sender<String>),
|
PrintDebug(crossbeam_channel::Sender<String>),
|
||||||
}
|
}
|
||||||
|
@ -81,6 +82,12 @@ impl App {
|
||||||
script_var_process::on_application_death();
|
script_var_process::on_application_death();
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
|
EwwCommand::CloseAll => {
|
||||||
|
log::info!("Received close command, closing all windows");
|
||||||
|
for (window_name, _window) in self.windows.clone() {
|
||||||
|
self.close_window(&window_name)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
EwwCommand::OpenWindow {
|
EwwCommand::OpenWindow {
|
||||||
window_name,
|
window_name,
|
||||||
pos,
|
pos,
|
||||||
|
|
|
@ -84,6 +84,10 @@ pub enum ActionWithServer {
|
||||||
#[structopt(name = "kill")]
|
#[structopt(name = "kill")]
|
||||||
KillServer,
|
KillServer,
|
||||||
|
|
||||||
|
/// Close all windows, without killing the daemon
|
||||||
|
#[structopt(name = "close-all")]
|
||||||
|
CloseAll,
|
||||||
|
|
||||||
/// Print the current eww-state
|
/// Print the current eww-state
|
||||||
#[structopt(name = "state")]
|
#[structopt(name = "state")]
|
||||||
ShowState,
|
ShowState,
|
||||||
|
@ -139,6 +143,7 @@ impl ActionWithServer {
|
||||||
},
|
},
|
||||||
ActionWithServer::CloseWindow { window_name } => app::EwwCommand::CloseWindow { window_name },
|
ActionWithServer::CloseWindow { window_name } => app::EwwCommand::CloseWindow { window_name },
|
||||||
ActionWithServer::KillServer => app::EwwCommand::KillServer,
|
ActionWithServer::KillServer => app::EwwCommand::KillServer,
|
||||||
|
ActionWithServer::CloseAll => app::EwwCommand::CloseAll,
|
||||||
ActionWithServer::ShowState => {
|
ActionWithServer::ShowState => {
|
||||||
let (send, recv) = crossbeam_channel::unbounded();
|
let (send, recv) = crossbeam_channel::unbounded();
|
||||||
return (app::EwwCommand::PrintState(send), Some(recv));
|
return (app::EwwCommand::PrintState(send), Some(recv));
|
||||||
|
|
Loading…
Add table
Reference in a new issue