summaryrefslogtreecommitdiffstats
path: root/default-plugins/status-bar/src/tip/data/sync_tab.rs
diff options
context:
space:
mode:
Diffstat (limited to 'default-plugins/status-bar/src/tip/data/sync_tab.rs')
-rw-r--r--default-plugins/status-bar/src/tip/data/sync_tab.rs69
1 files changed, 69 insertions, 0 deletions
diff --git a/default-plugins/status-bar/src/tip/data/sync_tab.rs b/default-plugins/status-bar/src/tip/data/sync_tab.rs
new file mode 100644
index 000000000..27d0ae7f0
--- /dev/null
+++ b/default-plugins/status-bar/src/tip/data/sync_tab.rs
@@ -0,0 +1,69 @@
+use ansi_term::{
+ unstyled_len, ANSIString, ANSIStrings,
+ Color::{Fixed, RGB},
+ Style,
+};
+
+use crate::LinePart;
+use zellij_tile::prelude::*;
+use zellij_tile_utils::palette_match;
+
+macro_rules! strings {
+ ($ANSIStrings:expr) => {{
+ let strings: &[ANSIString<'static>] = $ANSIStrings;
+
+ let ansi_strings = ANSIStrings(strings);
+
+ LinePart {
+ part: format!("{}", ansi_strings),
+ len: unstyled_len(&ansi_strings),
+ }
+ }};
+}
+
+pub fn sync_tab_full(palette: Palette) -> LinePart {
+ // Tip: Sync a tab and write keyboard input to all panes with Ctrl + <t> + <s>
+ let green_color = palette_match!(palette.green);
+ let orange_color = palette_match!(palette.orange);
+
+ strings!(&[
+ Style::new().paint(" Tip: "),
+ Style::new().paint("Sync a tab and write keyboard input to all its panes with "),
+ Style::new().fg(orange_color).bold().paint("Ctrl"),
+ Style::new().paint(" + "),
+ Style::new().fg(green_color).bold().paint("<t>"),
+ Style::new().paint(" + "),
+ Style::new().fg(green_color).bold().paint("<s>"),
+ ])
+}
+
+pub fn sync_tab_medium(palette: Palette) -> LinePart {
+ // Tip: Sync input to panes in a tab with Ctrl + <t> + <s>
+ let green_color = palette_match!(palette.green);
+ let orange_color = palette_match!(palette.orange);
+
+ strings!(&[
+ Style::new().paint(" Tip: "),
+ Style::new().paint("Sync input to panes in a tab with "),
+ Style::new().fg(orange_color).bold().paint("Ctrl"),
+ Style::new().paint(" + "),
+ Style::new().fg(green_color).bold().paint("<t>"),
+ Style::new().paint(" + "),
+ Style::new().fg(green_color).bold().paint("<s>"),
+ ])
+}
+
+pub fn sync_tab_short(palette: Palette) -> LinePart {
+ // Sync input in a tab with Ctrl + <t> + <s>
+ let green_color = palette_match!(palette.green);
+ let orange_color = palette_match!(palette.orange);
+
+ strings!(&[
+ Style::new().paint(" Sync input in a tab with "),
+ Style::new().fg(orange_color).bold().paint("Ctrl"),
+ Style::new().paint(" + "),
+ Style::new().fg(green_color).bold().paint("<t>"),
+ Style::new().paint(" + "),
+ Style::new().fg(green_color).bold().paint("<s>"),
+ ])
+}