Skip to content

Add per-pane pause state#494

Open
NotAShelf wants to merge 3 commits intoimsnif:mainfrom
NotAShelf:notashelf/push-myskzyyqpyyu
Open

Add per-pane pause state#494
NotAShelf wants to merge 3 commits intoimsnif:mainfrom
NotAShelf:notashelf/push-myskzyyqpyyu

Conversation

@NotAShelf
Copy link
Copy Markdown

Hi!

I'm a long-term enjoyer of bandwhich, but the amount of fine-grained interactivity was bothering me a little bit. Sometimes I want to pause a single pane (which is the main focus of this PR) but to allow future per-pane actions I've abstracted the logic a little bit. We now have per-pane focus and pausing for the UI, allowing users to cycle focus between panes and freeze the data in a specific pane independently of the global pause state. For per-pane events I've introduced entirely new keybinds, but let me know if you'd like for this to be modifier based (e.g., Shift+tab for focus shift and Shift+space for panel freeze) instead of polluting the "statusline" with new binds.

The changes (hopefully) collectively enable more interactive and granular control over the display. I am hoping that this could be a trampoline of some sorts to make each pane more functional for users monitoring multiple network data panes simultaneously.

Should this be merged, I am hoping to add a per-pane filter (/ while a pane is focused) to allow filtering for a specific process or address. Could also supersede #470 in the future to convert a pane to tree mode similar to btop's process view.

Add pane_paused: [bool; 3] indexed by logical table order
(0=processes, 1=remote_addresses, 2=connections). Guard each
sort_and_prune write so frozen panes hold their last snapshot
while live data keeps accumulating.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ice1e2564862613ee8e5cc1e940b30cd46a6a6964
Introduce display/input.rs with WidgetAction enum as the extensibility
hook for future per-pane keybindings. Add handle_widget_action() and
toggle_pane_pause() to Ui. Thread focused_pane: Option<usize> through
Ui::draw() and Layout::render().

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I2499d5a2b42290898e506efc7cede19c6a6a6964

add WidgetAction abstraction and per-pane focus/pause dispatch

Introduce display/input.rs with WidgetAction enum as the extensibility
hook for future per-pane keybindings. Add handle_widget_action() and
toggle_pane_pause() to Ui. Thread focused_pane: Option<usize> through
Ui::draw() and Layout::render().

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I2499d5a2b42290898e506efc7cede19c6a6a6964
<N> cycles focus through panes (None -> 0 -> 1 -> 2 -> None);
focused pane gets a thick cyan border. <F> freezes/unfreezes the
focused pane, showing [PAUSED] in yellow in its title. Help footer
shows contextual hints for both keys, gated on terminal width.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Id17f0119a115b4026e377a4f0c502c276a6a6964
Comment thread src/display/mod.rs
Comment on lines 7 to 11
pub use components::*;
pub use input::*;
pub use raw_terminal_backend::*;
pub use ui::*;
pub use ui_state::*;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is outside the scope of this PR, but I believe use foo::* is bad practice. Imo we should convert this to proper, explicit uses for code hygiene.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant