diff options
-rwxr-xr-x | assets/plugins/status-bar.wasm | bin | 546487 -> 545535 bytes | |||
-rwxr-xr-x | assets/plugins/strider.wasm | bin | 583654 -> 582975 bytes | |||
-rwxr-xr-x | assets/plugins/tab-bar.wasm | bin | 446809 -> 444598 bytes | |||
-rw-r--r-- | default-plugins/status-bar/src/main.rs | 9 | ||||
-rw-r--r-- | default-plugins/status-bar/src/second_line.rs | 78 | ||||
-rw-r--r-- | src/tests/e2e/snapshots/zellij__tests__e2e__cases__toggle_floating_panes.snap | 2 | ||||
-rw-r--r-- | zellij-server/src/screen.rs | 3 | ||||
-rw-r--r-- | zellij-server/src/tab/mod.rs | 3 | ||||
-rw-r--r-- | zellij-tile/src/data.rs | 1 |
9 files changed, 94 insertions, 2 deletions
diff --git a/assets/plugins/status-bar.wasm b/assets/plugins/status-bar.wasm Binary files differindex 53d84a2cd..2fcfccd0f 100755 --- a/assets/plugins/status-bar.wasm +++ b/assets/plugins/status-bar.wasm diff --git a/assets/plugins/strider.wasm b/assets/plugins/strider.wasm Binary files differindex 2e7d47d48..2afaa00e1 100755 --- a/assets/plugins/strider.wasm +++ b/assets/plugins/strider.wasm diff --git a/assets/plugins/tab-bar.wasm b/assets/plugins/tab-bar.wasm Binary files differindex 366a71a19..7fca16e1e 100755 --- a/assets/plugins/tab-bar.wasm +++ b/assets/plugins/tab-bar.wasm diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index 27dc3262d..daeb30f13 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -10,7 +10,8 @@ use zellij_tile_utils::style; use first_line::{ctrl_keys, superkey}; use second_line::{ - fullscreen_panes_to_hide, keybinds, locked_fullscreen_panes_to_hide, system_clipboard_error, + floating_panes_are_visible, fullscreen_panes_to_hide, keybinds, + locked_floating_panes_are_visible, locked_fullscreen_panes_to_hide, system_clipboard_error, text_copied_hint, }; use tip::utils::get_cached_tip_name; @@ -222,6 +223,12 @@ impl State { ), _ => 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), + _ => keybinds(&self.mode_info, &self.tip_name, cols), + } } else { keybinds(&self.mode_info, &self.tip_name, cols) } diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index d33efc02e..77868a72c 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -396,6 +396,57 @@ pub fn fullscreen_panes_to_hide(palette: &Palette, panes_to_hide: usize) -> Line } } +pub fn floating_panes_are_visible(palette: &Palette) -> LinePart { + let white_color = match palette.white { + PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), + PaletteColor::EightBit(color) => Fixed(color), + }; + let green_color = match palette.green { + PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), + PaletteColor::EightBit(color) => Fixed(color), + }; + let orange_color = match palette.orange { + PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), + PaletteColor::EightBit(color) => Fixed(color), + }; + let shortcut_left_separator = Style::new().fg(white_color).bold().paint(" ("); + let shortcut_right_separator = Style::new().fg(white_color).bold().paint("): "); + let floating_panes = "FLOATING PANES VISIBLE"; + let press = "Press "; + let ctrl = "Ctrl-p "; + let plus = "+ "; + let p_left_separator = "<"; + let p = "w"; + let p_right_separator = "> "; + let to_hide = "to hide."; + + let len = floating_panes.chars().count() + + press.chars().count() + + ctrl.chars().count() + + plus.chars().count() + + p_left_separator.chars().count() + + p.chars().count() + + p_right_separator.chars().count() + + to_hide.chars().count() + + 5; // 3 for ():'s around floating_panes, 2 for the space + LinePart { + part: format!( + "{}{}{}{}{}{}{}{}{}{}", + shortcut_left_separator, + Style::new().fg(orange_color).bold().paint(floating_panes), + shortcut_right_separator, + Style::new().fg(white_color).bold().paint(press), + Style::new().fg(green_color).bold().paint(ctrl), + Style::new().fg(white_color).bold().paint(plus), + Style::new().fg(white_color).bold().paint(p_left_separator), + Style::new().fg(green_color).bold().paint(p), + Style::new().fg(white_color).bold().paint(p_right_separator), + Style::new().fg(white_color).bold().paint(to_hide), + ), + len, + } +} + pub fn tmux_mode_indication(help: &ModeInfo) -> LinePart { let white_color = match help.palette.white { PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), @@ -520,3 +571,30 @@ pub fn locked_fullscreen_panes_to_hide(palette: &Palette, panes_to_hide: usize) len, } } + +pub fn locked_floating_panes_are_visible(palette: &Palette) -> LinePart { + let white_color = match palette.white { + PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), + PaletteColor::EightBit(color) => Fixed(color), + }; + let orange_color = match palette.orange { + PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), + PaletteColor::EightBit(color) => Fixed(color), + }; + let shortcut_left_separator = Style::new().fg(white_color).bold().paint(" ("); + let shortcut_right_separator = Style::new().fg(white_color).bold().paint(")"); + let locked_text = " -- INTERFACE LOCKED -- "; + let floating_panes = "FLOATING PANES VISIBLE"; + + let len = locked_text.chars().count() + floating_panes.chars().count(); + LinePart { + part: format!( + "{}{}{}{}", + Style::new().fg(white_color).bold().paint(locked_text), + shortcut_left_separator, + Style::new().fg(orange_color).bold().paint(floating_panes), + shortcut_right_separator, + ), + len, + } +} diff --git a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__toggle_floating_panes.snap b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__toggle_floating_panes.snap index fb247c070..b1633f02f 100644 --- a/src/tests/e2e/snapshots/zellij__tests__e2e__cases__toggle_floating_panes.snap +++ b/src/tests/e2e/snapshots/zellij__tests__e2e__cases__toggle_floating_panes.snap @@ -26,4 +26,4 @@ expression: last_snapshot │ │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Ctrl + <g> LOCK <p> PANE <t> TAB <n> RESIZE <h> MOVE <s> SCROLL <o> SESSION <q> QUIT - Tip: Alt + <n> => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane. + (FLOATING PANES VISIBLE): Press Ctrl-p + <w> to hide. diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 4eebbeb91..4145e0c29 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -605,6 +605,7 @@ impl Screen { panes_to_hide: tab.panes_to_hide.len(), is_fullscreen_active: tab.is_fullscreen_active(), is_sync_panes_active: tab.is_sync_panes_active(), + are_floating_panes_visible: tab.are_floating_panes_visible(), other_focused_clients, }); } @@ -768,6 +769,7 @@ pub(crate) fn screen_thread_main( .senders .send_to_server(ServerInstruction::UnblockInputThread) .unwrap(); + screen.update_tabs(); // update tabs so that the ui indication will be send to the plugins screen.render(); } ScreenInstruction::ToggleFloatingPanes(client_id, default_shell) => { @@ -780,6 +782,7 @@ pub(crate) fn screen_thread_main( .senders .send_to_server(ServerInstruction::UnblockInputThread) .unwrap(); + screen.update_tabs(); // update tabs so that the ui indication will be send to the plugins screen.render(); } ScreenInstruction::HorizontalSplit(pid, client_id) => { diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index 2941ca853..fc876addf 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -1086,6 +1086,9 @@ impl Tab { pub fn is_fullscreen_active(&self) -> bool { self.fullscreen_is_active } + pub fn are_floating_panes_visible(&self) -> bool { + self.floating_panes.panes_are_visible() + } pub fn toggle_fullscreen_is_active(&mut self) { self.fullscreen_is_active = !self.fullscreen_is_active; } diff --git a/zellij-tile/src/data.rs b/zellij-tile/src/data.rs index 4ef8e493c..55ad08472 100644 --- a/zellij-tile/src/data.rs +++ b/zellij-tile/src/data.rs @@ -230,6 +230,7 @@ pub struct TabInfo { pub panes_to_hide: usize, pub is_fullscreen_active: bool, pub is_sync_panes_active: bool, + pub are_floating_panes_visible: bool, pub other_focused_clients: Vec<ClientId>, } |