mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-29 23:50:19 +00:00
Adding documentation to search feature.
This commit is contained in:
parent
66f27be4bf
commit
ffafba2374
3 changed files with 36 additions and 22 deletions
13
README.md
13
README.md
|
@ -10,16 +10,15 @@ A graphical top clone, written in Rust. Inspired by both [gtop](https://github.c
|
|||
|
||||
### Linux
|
||||
|
||||
You can install by cloning and using `cargo build --release`, or use `cargo install bottom`. Other installation methods based on distros are as follows:
|
||||
You can install the in-development version by cloning and using `cargo build --release`. You can get release versions using `cargo install bottom`, or manually building from the Releases page. Other installation methods based on distros are as follows:
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
You can get it from the AUR by installing `bottom`.
|
||||
You can get the release versions from the AUR by installing `bottom`.
|
||||
|
||||
### Windows
|
||||
|
||||
You can currently install by cloning and building yourself using `cargo build --release`, or use `cargo install bottom`
|
||||
. You may need to install a font like [FreeMono](https://fonts2u.com/free-monospaced.font) and use a terminal like cmder for font support to work properly, unfortunately.
|
||||
You can install the in-development version by cloning and using `cargo build --release`. You can get release versions using `cargo install bottom`, or manually building from the Releases page. You may need to install a font like [FreeMono](https://fonts2u.com/free-monospaced.font) and use a terminal like cmder for font support to work properly, unfortunately.
|
||||
|
||||
### macOS
|
||||
|
||||
|
@ -75,7 +74,7 @@ Run using `btm`.
|
|||
|
||||
- `f` to freeze the screen from updating with new data. Press `f` again to unfreeze. Note that monitoring will still continue in the background.
|
||||
|
||||
- `Ctrl-Up/Ctrl-k`, `Ctrl-Down/Ctrl-j`, `Ctrl-Left/Ctrl-h`, `Ctrl-Right/Ctrl-l` to navigate between widgets.
|
||||
- `Ctrl-Up` or `Ctrl-k`, `Ctrl-Down` or `Ctrl-j`, `Ctrl-Left` or `Ctrl-h`, `Ctrl-Right` or `Ctrl-l` to navigate between widgets.
|
||||
|
||||
- `Esc` to close a dialog window.
|
||||
|
||||
|
@ -83,7 +82,7 @@ Run using `btm`.
|
|||
|
||||
#### Scrollable Tables
|
||||
|
||||
- `Up/k` and `Down/j` scrolls through the list if the widget is a table (Temperature, Disks, Processes).
|
||||
- `Up` or `k` and `Down` or `j` scrolls through the list if the widget is a table (Temperature, Disks, Processes).
|
||||
|
||||
- `gg` or `Home` to jump to the first entry of the current table.
|
||||
|
||||
|
@ -103,6 +102,8 @@ Run using `btm`.
|
|||
|
||||
- `Tab` to group together processes with the same name. Disables PID sorting. `dd` will now kill all processes covered by that name.
|
||||
|
||||
- `Ctrl-f` or `/` to toggle a search box for finding a process. By default this searches for process name, press `p` or `n` within the search bar to switch between searching for PID and name respectively.
|
||||
|
||||
### Mouse actions
|
||||
|
||||
- Scrolling with the mouse will scroll through the currently selected list, similar to using the up/down arrow keys.
|
||||
|
|
|
@ -58,6 +58,7 @@ pub struct App {
|
|||
pub canvas_data: canvas::CanvasData,
|
||||
enable_grouping: bool,
|
||||
enable_searching: bool,
|
||||
current_search_phrase: String,
|
||||
}
|
||||
|
||||
impl App {
|
||||
|
@ -98,6 +99,7 @@ impl App {
|
|||
canvas_data: canvas::CanvasData::default(),
|
||||
enable_grouping: false,
|
||||
enable_searching: false,
|
||||
current_search_phrase: String::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,15 +28,15 @@ const WINDOWS_NETWORK_HEADERS: [&str; 2] = ["RX", "TX"];
|
|||
const FORCE_MIN_THRESHOLD: usize = 5;
|
||||
|
||||
lazy_static! {
|
||||
static ref HELP_TEXT: [Text<'static>; 15] = [
|
||||
static ref HELP_TEXT: [Text<'static>; 17] = [
|
||||
Text::raw("\nGeneral Keybindings\n"),
|
||||
Text::raw("Ctrl-q, Ctrl-c to quit.\n"),
|
||||
Text::raw("Ctrl-r to reset all data.\n"),
|
||||
Text::raw("f to toggle freezing and unfreezing the display.\n"),
|
||||
Text::raw(
|
||||
"Ctrl-Up/Ctrl-k, Ctrl-Down/Ctrl-j, Ctrl-Left/Ctrl-h, Ctrl-Right/Ctrl-l to navigate between widgets.\n"
|
||||
"Ctrl-Up or Ctrl-k, Ctrl-Down or Ctrl-j, Ctrl-Left or Ctrl-h, Ctrl-Right or Ctrl-l to navigate between widgets.\n"
|
||||
),
|
||||
Text::raw("Up/k and Down/j scrolls through a list.\n"),
|
||||
Text::raw("Up or k and Down or j scrolls through a list.\n"),
|
||||
Text::raw("Esc to close a dialog window (help or dd confirmation).\n"),
|
||||
Text::raw("? to get this help screen.\n"),
|
||||
Text::raw("\n Process Widget Keybindings\n"),
|
||||
|
@ -45,7 +45,9 @@ lazy_static! {
|
|||
Text::raw("m to sort by memory usage.\n"),
|
||||
Text::raw("p to sort by PID.\n"),
|
||||
Text::raw("n to sort by process name.\n"),
|
||||
Text::raw("`Tab` to group together processes with the same name.\n")
|
||||
Text::raw("Tab to group together processes with the same name.\n"),
|
||||
Text::raw("Ctrl-f or / to toggle searching for a process. Use p and n to toggle between searching for PID and name.\n"),
|
||||
Text::raw("\nFor startup flags, type in \"btm -h\".")
|
||||
];
|
||||
static ref COLOUR_LIST: Vec<Color> = gen_n_colours(constants::NUM_COLOURS);
|
||||
static ref CANVAS_BORDER_STYLE: Style = Style::default().fg(BORDER_STYLE_COLOUR);
|
||||
|
@ -149,9 +151,9 @@ pub fn draw_data<B: backend::Backend>(
|
|||
.margin(1)
|
||||
.constraints(
|
||||
[
|
||||
Constraint::Percentage(32),
|
||||
Constraint::Percentage(40),
|
||||
Constraint::Percentage(28),
|
||||
Constraint::Percentage(27),
|
||||
Constraint::Percentage(50),
|
||||
Constraint::Percentage(23),
|
||||
]
|
||||
.as_ref(),
|
||||
)
|
||||
|
@ -307,14 +309,7 @@ pub fn draw_data<B: backend::Backend>(
|
|||
let network_chunk = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.margin(0)
|
||||
.constraints(
|
||||
if app_state.left_legend {
|
||||
[Constraint::Percentage(10), Constraint::Percentage(90)]
|
||||
} else {
|
||||
[Constraint::Percentage(75), Constraint::Percentage(10)]
|
||||
}
|
||||
.as_ref(),
|
||||
)
|
||||
.constraints([Constraint::Percentage(75), Constraint::Percentage(25)].as_ref())
|
||||
.split(bottom_chunks[0]);
|
||||
|
||||
// Default chunk index based on left or right legend setting
|
||||
|
@ -343,8 +338,18 @@ pub fn draw_data<B: backend::Backend>(
|
|||
draw_disk_table(&mut f, app_state, middle_divided_chunk_2[1]);
|
||||
|
||||
// Processes table
|
||||
if app_state.is_searching() {
|
||||
let processes_chunk = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.margin(0)
|
||||
.constraints([Constraint::Percentage(25), Constraint::Percentage(75)].as_ref())
|
||||
.split(bottom_chunks[1]);
|
||||
draw_search_field(&mut f, app_state, processes_chunk[0]);
|
||||
draw_processes_table(&mut f, app_state, processes_chunk[1]);
|
||||
} else {
|
||||
draw_processes_table(&mut f, app_state, bottom_chunks[1]);
|
||||
}
|
||||
}
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
|
@ -833,6 +838,12 @@ fn draw_disk_table<B: backend::Backend>(
|
|||
.render(f, draw_loc);
|
||||
}
|
||||
|
||||
fn draw_search_field<B: backend::Backend>(
|
||||
f: &mut Frame<B>, app_state: &mut app::App, draw_loc: Rect,
|
||||
) {
|
||||
// TODO: Search field
|
||||
}
|
||||
|
||||
fn draw_processes_table<B: backend::Backend>(
|
||||
f: &mut Frame<B>, app_state: &mut app::App, draw_loc: Rect,
|
||||
) {
|
||||
|
|
Loading…
Reference in a new issue