From 1c6853cc5d2e3bb08801f67089e82b4f5972bd3f Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Sun, 3 Jan 2021 15:01:36 +0100 Subject: [PATCH] add eww open-many --- src/app.rs | 6 ++++++ src/opts.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/app.rs b/src/app.rs index 083f7a3..ed6bb09 100644 --- a/src/app.rs +++ b/src/app.rs @@ -20,6 +20,7 @@ pub enum EwwCommand { UpdateVars(Vec<(VarName, PrimitiveValue)>), ReloadConfig(config::EwwConfig), ReloadCss(String), + OpenMany(Vec), OpenWindow { window_name: WindowName, pos: Option, @@ -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, diff --git a/src/opts.rs b/src/opts.rs index 058ac64..3724d91 100644 --- a/src/opts.rs +++ b/src/opts.rs @@ -74,6 +74,11 @@ pub enum ActionWithServer { anchor: Option, }, + /// 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 }, + /// 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,