add eww open-many

This commit is contained in:
elkowar 2021-01-03 15:01:36 +01:00 committed by ElKowar
parent 5fac2271b5
commit 1c6853cc5d
2 changed files with 12 additions and 0 deletions

View file

@ -20,6 +20,7 @@ pub enum EwwCommand {
UpdateVars(Vec<(VarName, PrimitiveValue)>),
ReloadConfig(config::EwwConfig),
ReloadCss(String),
OpenMany(Vec<WindowName>),
OpenWindow {
window_name: WindowName,
pos: Option<Coords>,
@ -88,6 +89,11 @@ impl App {
self.close_window(&window_name)?;
}
}
EwwCommand::OpenMany(windows) => {
for window in windows {
self.open_window(&window, None, None, None)?;
}
}
EwwCommand::OpenWindow {
window_name,
pos,

View file

@ -74,6 +74,11 @@ pub enum ActionWithServer {
anchor: Option<AnchorPoint>,
},
/// Open multiple windows at once.
/// NOTE: This will in the future be part of eww open, and will then be removed.
#[structopt(name = "open-many")]
OpenMany { windows: Vec<WindowName> },
/// Close the window with the given name
#[structopt(name = "close")]
CloseWindow { window_name: WindowName },
@ -127,6 +132,7 @@ impl ActionWithServer {
let command = match self {
ActionWithServer::Daemon | ActionWithServer::Ping => app::EwwCommand::NoOp,
ActionWithServer::Update { mappings } => app::EwwCommand::UpdateVars(mappings.into_iter().collect()),
ActionWithServer::OpenMany { windows } => app::EwwCommand::OpenMany(windows),
ActionWithServer::OpenWindow {
window_name,
pos,