From c95d0e769f31b21f5e2d4aaf6465468344f1bfd6 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Tue, 25 Jul 2023 10:04:12 +0200 Subject: feat(plugins): make plugins configurable (#2646) * work * make every plugin entry point configurable * make integration tests pass * make e2e tests pass * add test for plugin configuration * add test snapshot * add plugin config parsing test * cleanups * style(fmt): rustfmt * style(comment): remove commented code --- default-plugins/status-bar/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'default-plugins/status-bar') diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index ee14e45d5..d768b35ed 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -8,6 +8,7 @@ use ansi_term::{ Style, }; +use std::collections::BTreeMap; use std::fmt::{Display, Error, Formatter}; use zellij_tile::prelude::actions::Action; use zellij_tile::prelude::*; @@ -196,7 +197,7 @@ fn color_elements(palette: Palette, different_color_alternates: bool) -> Colored } impl ZellijPlugin for State { - fn load(&mut self) { + fn load(&mut self, configuration: BTreeMap) { // TODO: Should be able to choose whether to use the cache through config. self.tip_name = get_cached_tip_name(); set_selectable(false); @@ -207,7 +208,10 @@ impl ZellijPlugin for State { EventType::InputReceived, EventType::SystemClipboardFailure, ]); - self.supermode = false; // TODO: from config + self.supermode = configuration + .get("supermode") + .and_then(|s| s.trim().parse().ok()) + .unwrap_or(false); self.standby_mode = InputMode::Pane; if self.supermode { switch_to_input_mode(&InputMode::Locked); // supermode should start locked (TODO: only -- cgit v1.2.3