Skip to content

Commit

Permalink
feat: Reattached the block.
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Willems <jw@elevenbits.com>
  • Loading branch information
jw committed Feb 23, 2024
1 parent 4f5781d commit 41b2f56
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ratatui::layout::Constraint::Percentage;
use ratatui::widgets::{Cell, Row, Table};
use ratatui::{
prelude::*,
widgets::{block::Title, Block, BorderType, Borders, Padding},
widgets::{block::Title, Block, BorderType, Borders},
};
use uzers::get_user_by_uid;

Expand Down Expand Up @@ -175,16 +175,18 @@ fn ui(frame: &mut Frame) {

info!("Battery: {}", model::get_battery());

let header = ["pid", "ppid", "command", "threads", "user", "mem", "cpu"]
.iter()
.cloned()
.map(Cell::from)
.collect::<Row>()
.height(1);
let header = [
"Pid:", "Ppid:", "Command:", "Threads:", "User:", "MemB", "Cpu%",
]
.iter()
.cloned()
.map(Cell::from)
.collect::<Row>()
.height(1);

let _block = Block::default()
let block = Block::default()
.title(Title::from("brt").alignment(Alignment::Center))
.padding(Padding::new(0, 0, frame.size().height / 2 - 1, 0))
// .padding(Padding::new(0, 0, frame.size().height / 2 - 1, 0))
.borders(Borders::ALL)
.border_style(Style::default().fg(Color::White))
.border_type(BorderType::Rounded);
Expand All @@ -198,7 +200,7 @@ fn ui(frame: &mut Frame) {
Percentage(5),
Percentage(5),
];
let table = Table::new(rows, widths).header(header);
let table = Table::new(rows, widths).block(block).header(header);

frame.render_widget(table, layout[0]);
}
Expand Down

0 comments on commit 41b2f56

Please sign in to comment.