diff options
author | Aram Drevekenin <aram@poor.dev> | 2021-05-17 18:13:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-17 18:13:05 +0200 |
commit | a3f42b19a98c00b90fdd60a0486275a5f1829226 (patch) | |
tree | 1b57c80b8e6814851cf7c47fcf0bf9e5f00fadc6 /default-plugins | |
parent | 84911619b27fec7aa5d13f4d60db2e8625dc3a04 (diff) |
Osc implementation (#517)
* fix(compatibility): implement most osc methods
* style(fmt): rustfmt
* style(fmt): remove cargo warnings
* style(fmt): make clippy happy
* style(fmt): fix formatting after my clippy fixes broke it again ;P
* fix(grid): fix tests
Diffstat (limited to 'default-plugins')
-rw-r--r-- | default-plugins/status-bar/src/main.rs | 64 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/line.rs | 12 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/main.rs | 2 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/tab.rs | 8 |
4 files changed, 47 insertions, 39 deletions
diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index bb56c279a..cf9445d6a 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -72,55 +72,61 @@ pub struct ColoredElements { // that can be defined in the config perhaps fn color_elements(palette: Palette) -> ColoredElements { match palette.source { + // "cyan" here is used as a background as a dirty hack + // this is because the Palette struct doesn't have a "gray" section + // and we can't use its "bg" because that is now dynamically taken from the terminal + // and might often not actually fit the rest of the colorscheme + // + // to fix this, we need to restructure the Palette struct PaletteSource::Default => ColoredElements { - selected_prefix_separator: style!(palette.bg, palette.green), + selected_prefix_separator: style!(palette.cyan, palette.green), selected_char_left_separator: style!(palette.black, palette.green).bold(), selected_char_shortcut: style!(palette.red, palette.green).bold(), selected_char_right_separator: style!(palette.black, palette.green).bold(), selected_styled_text: style!(palette.black, palette.green).bold(), - selected_suffix_separator: style!(palette.green, palette.bg).bold(), - unselected_prefix_separator: style!(palette.bg, palette.fg), + selected_suffix_separator: style!(palette.green, palette.cyan).bold(), + unselected_prefix_separator: style!(palette.cyan, palette.fg), unselected_char_left_separator: style!(palette.black, palette.fg).bold(), unselected_char_shortcut: style!(palette.red, palette.fg).bold(), unselected_char_right_separator: style!(palette.black, palette.fg).bold(), unselected_styled_text: style!(palette.black, palette.fg).bold(), - unselected_suffix_separator: style!(palette.fg, palette.bg), - disabled_prefix_separator: style!(palette.bg, palette.fg), - disabled_styled_text: style!(palette.bg, palette.fg).dimmed(), - disabled_suffix_separator: style!(palette.fg, palette.bg), - selected_single_letter_prefix_separator: style!(palette.bg, palette.green), + unselected_suffix_separator: style!(palette.fg, palette.cyan), + disabled_prefix_separator: style!(palette.cyan, palette.fg), + disabled_styled_text: style!(palette.cyan, palette.fg).dimmed(), + disabled_suffix_separator: style!(palette.fg, palette.cyan), + selected_single_letter_prefix_separator: style!(palette.cyan, palette.green), selected_single_letter_char_shortcut: style!(palette.red, palette.green).bold(), - selected_single_letter_suffix_separator: style!(palette.green, palette.bg), - unselected_single_letter_prefix_separator: style!(palette.bg, palette.fg), + selected_single_letter_suffix_separator: style!(palette.green, palette.cyan), + unselected_single_letter_prefix_separator: style!(palette.cyan, palette.fg), unselected_single_letter_char_shortcut: style!(palette.red, palette.fg).bold(), - unselected_single_letter_suffix_separator: style!(palette.fg, palette.bg), - superkey_prefix: style!(palette.white, palette.bg).bold(), - superkey_suffix_separator: style!(palette.bg, palette.bg), + unselected_single_letter_suffix_separator: style!(palette.fg, palette.cyan), + superkey_prefix: style!(palette.white, palette.cyan).bold(), + superkey_suffix_separator: style!(palette.cyan, palette.cyan), }, PaletteSource::Xresources => ColoredElements { - selected_prefix_separator: style!(palette.bg, palette.green), + selected_prefix_separator: style!(palette.cyan, palette.green), selected_char_left_separator: style!(palette.fg, palette.green).bold(), selected_char_shortcut: style!(palette.red, palette.green).bold(), selected_char_right_separator: style!(palette.fg, palette.green).bold(), - selected_styled_text: style!(palette.bg, palette.green).bold(), - selected_suffix_separator: style!(palette.green, palette.bg).bold(), - unselected_prefix_separator: style!(palette.bg, palette.fg), - unselected_char_left_separator: style!(palette.bg, palette.fg).bold(), + selected_styled_text: style!(palette.cyan, palette.green).bold(), + selected_suffix_separator: style!(palette.green, palette.cyan).bold(), + unselected_prefix_separator: style!(palette.cyan, palette.fg), + unselected_char_left_separator: style!(palette.cyan, palette.fg).bold(), unselected_char_shortcut: style!(palette.red, palette.fg).bold(), - unselected_char_right_separator: style!(palette.bg, palette.fg).bold(), - unselected_styled_text: style!(palette.bg, palette.fg).bold(), - unselected_suffix_separator: style!(palette.fg, palette.bg), - disabled_prefix_separator: style!(palette.bg, palette.fg), - disabled_styled_text: style!(palette.bg, palette.fg).dimmed(), - disabled_suffix_separator: style!(palette.fg, palette.bg), + unselected_char_right_separator: style!(palette.cyan, palette.fg).bold(), + unselected_styled_text: style!(palette.cyan, palette.fg).bold(), + unselected_suffix_separator: style!(palette.fg, palette.cyan), + disabled_prefix_separator: style!(palette.cyan, palette.fg), + disabled_styled_text: style!(palette.cyan, palette.fg).dimmed(), + disabled_suffix_separator: style!(palette.fg, palette.cyan), selected_single_letter_prefix_separator: style!(palette.fg, palette.green), selected_single_letter_char_shortcut: style!(palette.red, palette.green).bold(), selected_single_letter_suffix_separator: style!(palette.green, palette.fg), - unselected_single_letter_prefix_separator: style!(palette.fg, palette.bg), + unselected_single_letter_prefix_separator: style!(palette.fg, palette.cyan), unselected_single_letter_char_shortcut: style!(palette.red, palette.fg).bold(), - unselected_single_letter_suffix_separator: style!(palette.fg, palette.bg), - superkey_prefix: style!(palette.bg, palette.fg).bold(), - superkey_suffix_separator: style!(palette.fg, palette.bg), + unselected_single_letter_suffix_separator: style!(palette.fg, palette.cyan), + superkey_prefix: style!(palette.cyan, palette.fg).bold(), + superkey_suffix_separator: style!(palette.fg, palette.cyan), }, } } @@ -155,7 +161,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.bg { + match self.mode_info.palette.cyan { PaletteColor::Rgb((r, g, b)) => { println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", first_line, r, g, b); } diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index 574edb78d..fce8982da 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -62,11 +62,11 @@ fn left_more_message(tab_count_to_the_left: usize, palette: Palette, separator: }; // 238 let more_text_len = more_text.chars().count() + 2; // 2 for the arrows - let left_separator = style!(palette.bg, palette.orange).paint(separator); + let left_separator = style!(palette.cyan, palette.orange).paint(separator); let more_styled_text = style!(palette.black, palette.orange) .bold() .paint(more_text); - let right_separator = style!(palette.orange, palette.bg).paint(separator); + let right_separator = style!(palette.orange, palette.cyan).paint(separator); let more_styled_text = format!( "{}", ANSIStrings(&[left_separator, more_styled_text, right_separator,]) @@ -94,11 +94,11 @@ fn right_more_message( " +many → ".to_string() }; let more_text_len = more_text.chars().count() + 1; // 2 for the arrow - let left_separator = style!(palette.bg, palette.orange).paint(separator); + let left_separator = style!(palette.cyan, palette.orange).paint(separator); let more_styled_text = style!(palette.black, palette.orange) .bold() .paint(more_text); - let right_separator = style!(palette.orange, palette.bg).paint(separator); + let right_separator = style!(palette.orange, palette.cyan).paint(separator); let more_styled_text = format!( "{}", ANSIStrings(&[left_separator, more_styled_text, right_separator,]) @@ -147,7 +147,9 @@ fn add_next_tabs_msg( fn tab_line_prefix(palette: Palette) -> LinePart { let prefix_text = " Zellij ".to_string(); let prefix_text_len = prefix_text.chars().count(); - let prefix_styled_text = style!(palette.white, palette.bg).bold().paint(prefix_text); + let prefix_styled_text = style!(palette.white, palette.cyan) + .bold() + .paint(prefix_text); LinePart { part: format!("{}", prefix_styled_text), len: prefix_text_len, diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs index 00ff4bd96..46336be3d 100644 --- a/default-plugins/tab-bar/src/main.rs +++ b/default-plugins/tab-bar/src/main.rs @@ -75,7 +75,7 @@ impl ZellijPlugin for State { for bar_part in tab_line { s = format!("{}{}", s, bar_part.part); } - match self.mode_info.palette.bg { + match self.mode_info.palette.cyan { PaletteColor::Rgb((r, g, b)) => { println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b); } diff --git a/default-plugins/tab-bar/src/tab.rs b/default-plugins/tab-bar/src/tab.rs index 85e2c378d..fb8e377d1 100644 --- a/default-plugins/tab-bar/src/tab.rs +++ b/default-plugins/tab-bar/src/tab.rs @@ -4,12 +4,12 @@ use zellij_tile::prelude::*; use zellij_tile_utils::style; pub fn active_tab(text: String, palette: Palette, separator: &str) -> LinePart { - let left_separator = style!(palette.bg, palette.green).paint(separator); + let left_separator = style!(palette.cyan, palette.green).paint(separator); let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the text padding let tab_styled_text = style!(palette.black, palette.green) .bold() .paint(format!(" {} ", text)); - let right_separator = style!(palette.green, palette.bg).paint(separator); + let right_separator = style!(palette.green, palette.cyan).paint(separator); let tab_styled_text = format!( "{}", ANSIStrings(&[left_separator, tab_styled_text, right_separator,]) @@ -21,12 +21,12 @@ pub fn active_tab(text: String, palette: Palette, separator: &str) -> LinePart { } pub fn non_active_tab(text: String, palette: Palette, separator: &str) -> LinePart { - let left_separator = style!(palette.bg, palette.fg).paint(separator); + let left_separator = style!(palette.cyan, palette.fg).paint(separator); let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the padding let tab_styled_text = style!(palette.black, palette.fg) .bold() .paint(format!(" {} ", text)); - let right_separator = style!(palette.fg, palette.bg).paint(separator); + let right_separator = style!(palette.fg, palette.cyan).paint(separator); let tab_styled_text = format!( "{}", ANSIStrings(&[left_separator, tab_styled_text, right_separator,]) |