aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/input
diff options
context:
space:
mode:
authorBrooks Rady <b.j.rady@gmail.com>2022-03-22 14:58:16 +0000
committerGitHub <noreply@github.com>2022-03-22 14:58:16 +0000
commit9bfafde12348623e2a5d1513ba0928e15d441efd (patch)
treeeced3310a2b8102189ae55e984104a94bed8a510 /zellij-utils/src/input
parentfix: cargo issue (#1253) (diff)
downloadsl0ppij-9bfafde12348623e2a5d1513ba0928e15d441efd.tar.gz
sl0ppij-9bfafde12348623e2a5d1513ba0928e15d441efd.tar.xz
sl0ppij-9bfafde12348623e2a5d1513ba0928e15d441efd.zip
feat(ui): round frame corners (#1227)
* feat(ui): round frame corners * Allow rounded_corners to be set without a palette * Revert "Allow rounded_corners to be set without a palette" This reverts commit 9271a4b5452f2e59e0ebd55136343f0fbfabaa13. * fix(style): remove redundant code * fix(style): clippy lints that somehow got missed * feat(config): add ui config section
Diffstat (limited to 'zellij-utils/src/input')
-rw-r--r--zellij-utils/src/input/config.rs9
-rw-r--r--zellij-utils/src/input/mod.rs13
-rw-r--r--zellij-utils/src/input/theme.rs10
3 files changed, 24 insertions, 8 deletions
diff --git a/zellij-utils/src/input/config.rs b/zellij-utils/src/input/config.rs
index 420749df..811f5d54 100644
--- a/zellij-utils/src/input/config.rs
+++ b/zellij-utils/src/input/config.rs
@@ -11,7 +11,7 @@ use std::convert::{TryFrom, TryInto};
use super::keybinds::{Keybinds, KeybindsFromYaml};
use super::options::Options;
use super::plugins::{PluginsConfig, PluginsConfigError, PluginsConfigFromYaml};
-use super::theme::ThemesFromYaml;
+use super::theme::{ThemesFromYaml, UiConfigFromYaml};
use crate::cli::{CliArgs, Command};
use crate::envs::EnvironmentVariablesFromYaml;
use crate::setup;
@@ -31,6 +31,7 @@ pub struct ConfigFromYaml {
pub env: Option<EnvironmentVariablesFromYaml>,
#[serde(default)]
pub plugins: PluginsConfigFromYaml,
+ pub ui: Option<UiConfigFromYaml>,
}
/// Main configuration.
@@ -40,6 +41,7 @@ pub struct Config {
pub options: Options,
pub themes: Option<ThemesFromYaml>,
pub plugins: PluginsConfig,
+ pub ui: Option<UiConfigFromYaml>,
pub env: EnvironmentVariablesFromYaml,
}
@@ -72,6 +74,7 @@ impl Default for Config {
let themes = None;
let env = EnvironmentVariablesFromYaml::default();
let plugins = PluginsConfig::default();
+ let ui = None;
Config {
keybinds,
@@ -79,6 +82,7 @@ impl Default for Config {
themes,
plugins,
env,
+ ui,
}
}
}
@@ -168,6 +172,7 @@ impl Config {
themes: self.themes.clone(), // TODO
env: self.env.merge(other.env),
plugins: self.plugins.merge(other.plugins),
+ ui: self.ui, // TODO
}
}
}
@@ -181,12 +186,14 @@ impl TryFrom<ConfigFromYaml> for Config {
let themes = config_from_yaml.themes;
let env = config_from_yaml.env.unwrap_or_default();
let plugins = PluginsConfig::get_plugins_with_default(config_from_yaml.plugins.try_into()?);
+ let ui = config_from_yaml.ui;
Ok(Self {
keybinds,
options,
plugins,
themes,
env,
+ ui,
})
}
}
diff --git a/zellij-utils/src/input/mod.rs b/zellij-utils/src/input/mod.rs
index 391fea7b..289e52ca 100644
--- a/zellij-utils/src/input/mod.rs
+++ b/zellij-utils/src/input/mod.rs
@@ -12,15 +12,14 @@ pub mod theme;
use crate::envs;
use termion::input::TermRead;
-use zellij_tile::data::{InputMode, Key, ModeInfo, Palette, PluginCapabilities};
+use zellij_tile::{
+ data::{InputMode, Key, ModeInfo, PluginCapabilities},
+ prelude::Style,
+};
/// Creates a [`ModeInfo`] struct indicating the current [`InputMode`] and its keybinds
/// (as pairs of [`String`]s).
-pub fn get_mode_info(
- mode: InputMode,
- palette: Palette,
- capabilities: PluginCapabilities,
-) -> ModeInfo {
+pub fn get_mode_info(mode: InputMode, style: Style, capabilities: PluginCapabilities) -> ModeInfo {
let keybinds = match mode {
InputMode::Normal | InputMode::Locked | InputMode::Prompt => Vec::new(),
InputMode::Resize => vec![
@@ -77,7 +76,7 @@ pub fn get_mode_info(
ModeInfo {
mode,
keybinds,
- palette,
+ style,
capabilities,
session_name,
}
diff --git a/zellij-utils/src/input/theme.rs b/zellij-utils/src/input/theme.rs
index 5bd8b921..f1fab580 100644
--- a/zellij-utils/src/input/theme.rs
+++ b/zellij-utils/src/input/theme.rs
@@ -8,6 +8,16 @@ use zellij_tile::data::{Palette, PaletteColor};
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct ThemesFromYaml(HashMap<String, Theme>);
+#[derive(Debug, Default, Clone, Copy, PartialEq, Deserialize, Serialize)]
+pub struct UiConfigFromYaml {
+ pub pane_frames: FrameConfigFromYaml,
+}
+
+#[derive(Debug, Default, Clone, Copy, PartialEq, Deserialize, Serialize)]
+pub struct FrameConfigFromYaml {
+ pub rounded_corners: bool,
+}
+
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
struct Theme {
#[serde(flatten)]