diff --git a/assets/plugins/status-bar.wasm b/assets/plugins/status-bar.wasm index 53d84a2c..2fcfccd0 100755 Binary files a/assets/plugins/status-bar.wasm and b/assets/plugins/status-bar.wasm differ diff --git a/assets/plugins/strider.wasm b/assets/plugins/strider.wasm index 2e7d47d4..2afaa00e 100755 Binary files a/assets/plugins/strider.wasm and b/assets/plugins/strider.wasm differ diff --git a/assets/plugins/tab-bar.wasm b/assets/plugins/tab-bar.wasm index 366a71a1..7fca16e1 100755 Binary files a/assets/plugins/tab-bar.wasm and b/assets/plugins/tab-bar.wasm differ diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index 27dc3262..daeb30f1 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 d33efc02..77868a72 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 fb247c07..b1633f02 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 + LOCK 

PANE  TAB  RESIZE  MOVE  SCROLL  SESSION  QUIT  - Tip: Alt + => new pane. Alt + <[] or hjkl> => navigate. Alt + <+-> => resize pane. + (FLOATING PANES VISIBLE): Press Ctrl-p + to hide. diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 4eebbeb9..4145e0c2 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 2941ca85..fc876add 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 4ef8e493..55ad0847 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, }