summaryrefslogtreecommitdiffstats
path: root/default-plugins
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 /default-plugins
parent2d55a3e274f1fc13d7adf8a1574188498efae82c (diff)
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 'default-plugins')
-rw-r--r--default-plugins/status-bar/src/first_line.rs2
-rw-r--r--default-plugins/status-bar/src/main.rs25
-rw-r--r--default-plugins/status-bar/src/second_line.rs42
-rw-r--r--default-plugins/tab-bar/src/main.rs6
4 files changed, 39 insertions, 36 deletions
diff --git a/default-plugins/status-bar/src/first_line.rs b/default-plugins/status-bar/src/first_line.rs
index ed67e5cc5..7ca0b0fb6 100644
--- a/default-plugins/status-bar/src/first_line.rs
+++ b/default-plugins/status-bar/src/first_line.rs
@@ -247,7 +247,7 @@ pub fn superkey(palette: ColoredElements, separator: &str) -> LinePart {
}
pub fn ctrl_keys(help: &ModeInfo, max_len: usize, separator: &str) -> LinePart {
- let colored_elements = color_elements(help.palette);
+ let colored_elements = color_elements(help.style.colors);
match &help.mode {
InputMode::Locked => key_indicators(
max_len,
diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs
index daeb30f13..471c45c76 100644
--- a/default-plugins/status-bar/src/main.rs
+++ b/default-plugins/status-bar/src/main.rs
@@ -175,10 +175,10 @@ impl ZellijPlugin for State {
let separator = if !self.mode_info.capabilities.arrow_fonts {
ARROW_SEPARATOR
} else {
- &""
+ ""
};
- let colored_elements = color_elements(self.mode_info.palette);
+ let colored_elements = color_elements(self.mode_info.style.colors);
let superkey = superkey(colored_elements, separator);
let ctrl_keys = ctrl_keys(
&self.mode_info,
@@ -191,7 +191,7 @@ impl ZellijPlugin for State {
// [48;5;238m is gray background, [0K is so that it fills the rest of the line
// [m is background reset, [0K is so that it clears the rest of the line
- match self.mode_info.palette.gray {
+ match self.mode_info.style.colors.gray {
PaletteColor::Rgb((r, g, b)) => {
println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", first_line, r, g, b);
}
@@ -208,25 +208,28 @@ impl State {
let active_tab = self.tabs.iter().find(|t| t.active);
if let Some(copy_destination) = self.text_copy_destination {
- text_copied_hint(&self.mode_info.palette, copy_destination)
+ text_copied_hint(&self.mode_info.style.colors, copy_destination)
} else if self.display_system_clipboard_failure {
- system_clipboard_error(&self.mode_info.palette)
+ system_clipboard_error(&self.mode_info.style.colors)
} else if let Some(active_tab) = active_tab {
if active_tab.is_fullscreen_active {
match self.mode_info.mode {
- InputMode::Normal => {
- fullscreen_panes_to_hide(&self.mode_info.palette, active_tab.panes_to_hide)
- }
+ InputMode::Normal => fullscreen_panes_to_hide(
+ &self.mode_info.style.colors,
+ active_tab.panes_to_hide,
+ ),
InputMode::Locked => locked_fullscreen_panes_to_hide(
- &self.mode_info.palette,
+ &self.mode_info.style.colors,
active_tab.panes_to_hide,
),
_ => keybinds(&self.mode_info, &self.tip_name, cols),
}
} else if active_tab.are_floating_panes_visible {
match self.mode_info.mode {
- InputMode::Normal => floating_panes_are_visible(&self.mode_info.palette),
- InputMode::Locked => locked_floating_panes_are_visible(&self.mode_info.palette),
+ InputMode::Normal => floating_panes_are_visible(&self.mode_info.style.colors),
+ InputMode::Locked => {
+ locked_floating_panes_are_visible(&self.mode_info.style.colors)
+ }
_ => keybinds(&self.mode_info, &self.tip_name, cols),
}
} else {
diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs
index 77868a72c..9601c4251 100644
--- a/default-plugins/status-bar/src/second_line.rs
+++ b/default-plugins/status-bar/src/second_line.rs
@@ -193,11 +193,11 @@ fn full_shortcut_list_nonstandard_mode(
move |help| {
let mut line_part = LinePart::default();
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
- let shortcut = full_length_shortcut(i == 0, letter, description, help.palette);
+ let shortcut = full_length_shortcut(i == 0, letter, description, help.style.colors);
line_part.len += shortcut.len;
line_part.part = format!("{}{}", line_part.part, shortcut,);
}
- let select_pane_shortcut = extra_hint_producing_function(help.palette);
+ let select_pane_shortcut = extra_hint_producing_function(help.style.colors);
line_part.len += select_pane_shortcut.len;
line_part.part = format!("{}{}", line_part.part, select_pane_shortcut,);
line_part
@@ -206,8 +206,8 @@ fn full_shortcut_list_nonstandard_mode(
fn full_shortcut_list(help: &ModeInfo, tip: TipFn) -> LinePart {
match help.mode {
- InputMode::Normal => tip(help.palette),
- InputMode::Locked => locked_interface_indication(help.palette),
+ InputMode::Normal => tip(help.style.colors),
+ InputMode::Locked => locked_interface_indication(help.style.colors),
InputMode::Tmux => full_tmux_mode_indication(help),
InputMode::RenamePane => full_shortcut_list_nonstandard_mode(select_pane_shortcut)(help),
_ => full_shortcut_list_nonstandard_mode(confirm_pane_selection)(help),
@@ -220,11 +220,11 @@ fn shortened_shortcut_list_nonstandard_mode(
move |help| {
let mut line_part = LinePart::default();
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
- let shortcut = first_word_shortcut(i == 0, letter, description, help.palette);
+ let shortcut = first_word_shortcut(i == 0, letter, description, help.style.colors);
line_part.len += shortcut.len;
line_part.part = format!("{}{}", line_part.part, shortcut,);
}
- let select_pane_shortcut = extra_hint_producing_function(help.palette);
+ let select_pane_shortcut = extra_hint_producing_function(help.style.colors);
line_part.len += select_pane_shortcut.len;
line_part.part = format!("{}{}", line_part.part, select_pane_shortcut,);
line_part
@@ -233,8 +233,8 @@ fn shortened_shortcut_list_nonstandard_mode(
fn shortened_shortcut_list(help: &ModeInfo, tip: TipFn) -> LinePart {
match help.mode {
- InputMode::Normal => tip(help.palette),
- InputMode::Locked => locked_interface_indication(help.palette),
+ InputMode::Normal => tip(help.style.colors),
+ InputMode::Locked => locked_interface_indication(help.style.colors),
InputMode::Tmux => short_tmux_mode_indication(help),
InputMode::RenamePane => {
shortened_shortcut_list_nonstandard_mode(select_pane_shortcut)(help)
@@ -249,7 +249,7 @@ fn best_effort_shortcut_list_nonstandard_mode(
move |help, max_len| {
let mut line_part = LinePart::default();
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
- let shortcut = first_word_shortcut(i == 0, letter, description, help.palette);
+ let shortcut = first_word_shortcut(i == 0, letter, description, help.style.colors);
if line_part.len + shortcut.len + MORE_MSG.chars().count() > max_len {
// TODO: better
line_part.part = format!("{}{}", line_part.part, MORE_MSG);
@@ -259,7 +259,7 @@ fn best_effort_shortcut_list_nonstandard_mode(
line_part.len += shortcut.len;
line_part.part = format!("{}{}", line_part.part, shortcut);
}
- let select_pane_shortcut = extra_hint_producing_function(help.palette);
+ let select_pane_shortcut = extra_hint_producing_function(help.style.colors);
if line_part.len + select_pane_shortcut.len <= max_len {
line_part.len += select_pane_shortcut.len;
line_part.part = format!("{}{}", line_part.part, select_pane_shortcut,);
@@ -271,7 +271,7 @@ fn best_effort_shortcut_list_nonstandard_mode(
fn best_effort_tmux_shortcut_list(help: &ModeInfo, max_len: usize) -> LinePart {
let mut line_part = tmux_mode_indication(help);
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
- let shortcut = first_word_shortcut(i == 0, letter, description, help.palette);
+ let shortcut = first_word_shortcut(i == 0, letter, description, help.style.colors);
if line_part.len + shortcut.len + MORE_MSG.chars().count() > max_len {
// TODO: better
line_part.part = format!("{}{}", line_part.part, MORE_MSG);
@@ -287,7 +287,7 @@ fn best_effort_tmux_shortcut_list(help: &ModeInfo, max_len: usize) -> LinePart {
fn best_effort_shortcut_list(help: &ModeInfo, tip: TipFn, max_len: usize) -> LinePart {
match help.mode {
InputMode::Normal => {
- let line_part = tip(help.palette);
+ let line_part = tip(help.style.colors);
if line_part.len <= max_len {
line_part
} else {
@@ -295,7 +295,7 @@ fn best_effort_shortcut_list(help: &ModeInfo, tip: TipFn, max_len: usize) -> Lin
}
}
InputMode::Locked => {
- let line_part = locked_interface_indication(help.palette);
+ let line_part = locked_interface_indication(help.style.colors);
if line_part.len <= max_len {
line_part
} else {
@@ -448,11 +448,11 @@ pub fn floating_panes_are_visible(palette: &Palette) -> LinePart {
}
pub fn tmux_mode_indication(help: &ModeInfo) -> LinePart {
- let white_color = match help.palette.white {
+ let white_color = match help.style.colors.white {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
};
- let orange_color = match help.palette.orange {
+ let orange_color = match help.style.colors.orange {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
};
@@ -472,11 +472,11 @@ pub fn tmux_mode_indication(help: &ModeInfo) -> LinePart {
}
pub fn full_tmux_mode_indication(help: &ModeInfo) -> LinePart {
- let white_color = match help.palette.white {
+ let white_color = match help.style.colors.white {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
};
- let orange_color = match help.palette.orange {
+ let orange_color = match help.style.colors.orange {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
};
@@ -494,7 +494,7 @@ pub fn full_tmux_mode_indication(help: &ModeInfo) -> LinePart {
};
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
- let shortcut = full_length_shortcut(i == 0, letter, description, help.palette);
+ let shortcut = full_length_shortcut(i == 0, letter, description, help.style.colors);
line_part.len += shortcut.len;
line_part.part = format!("{}{}", line_part.part, shortcut,);
}
@@ -502,11 +502,11 @@ pub fn full_tmux_mode_indication(help: &ModeInfo) -> LinePart {
}
pub fn short_tmux_mode_indication(help: &ModeInfo) -> LinePart {
- let white_color = match help.palette.white {
+ let white_color = match help.style.colors.white {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
};
- let orange_color = match help.palette.orange {
+ let orange_color = match help.style.colors.orange {
PaletteColor::Rgb((r, g, b)) => RGB(r, g, b),
PaletteColor::EightBit(color) => Fixed(color),
};
@@ -524,7 +524,7 @@ pub fn short_tmux_mode_indication(help: &ModeInfo) -> LinePart {
};
for (i, (letter, description)) in help.keybinds.iter().enumerate() {
- let shortcut = first_word_shortcut(i == 0, letter, description, help.palette);
+ let shortcut = first_word_shortcut(i == 0, letter, description, help.style.colors);
line_part.len += shortcut.len;
line_part.part = format!("{}{}", line_part.part, shortcut);
}
diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs
index 3db531384..05f241bbb 100644
--- a/default-plugins/tab-bar/src/main.rs
+++ b/default-plugins/tab-bar/src/main.rs
@@ -83,7 +83,7 @@ impl ZellijPlugin for State {
tabname,
t.active,
t.is_sync_panes_active,
- self.mode_info.palette,
+ self.mode_info.style.colors,
self.mode_info.capabilities,
t.other_focused_clients.as_slice(),
);
@@ -94,7 +94,7 @@ impl ZellijPlugin for State {
all_tabs,
active_tab_index,
cols.saturating_sub(1),
- self.mode_info.palette,
+ self.mode_info.style.colors,
self.mode_info.capabilities,
);
let mut s = String::new();
@@ -113,7 +113,7 @@ impl ZellijPlugin for State {
}
len_cnt += bar_part.len;
}
- match self.mode_info.palette.gray {
+ match self.mode_info.style.colors.gray {
PaletteColor::Rgb((r, g, b)) => {
println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b);
}