diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-07-25 10:04:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-25 10:04:12 +0200 |
commit | c95d0e769f31b21f5e2d4aaf6465468344f1bfd6 (patch) | |
tree | 9589f0875b91b73460b807e90817907bf3d7d8c6 /default-plugins/status-bar/src/main.rs | |
parent | 6cf795a7df6c83b65a4535b6af0338b4a0b1742f (diff) |
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
Diffstat (limited to 'default-plugins/status-bar/src/main.rs')
-rw-r--r-- | default-plugins/status-bar/src/main.rs | 8 |
1 files changed, 6 insertions, 2 deletions
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<String, String>) { // 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 |