Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ For more details on supported platforms and known problems, check out [the docum

bottom may work on a number of platforms that aren't officially supported. Note that unsupported platforms:

- Might not be tested in CI to build or pass tests (see [here](./.github/workflows/ci.yml) for checked platforms).
- Might not be tested in CI to build or pass tests ([checked platforms can be found here](./.github/workflows/ci.yml)).
- Might not be properly tested by maintainers prior to a stable release.
- May only receive limited support, such as missing features or bugs that may not be fixed.

Expand Down Expand Up @@ -328,15 +328,15 @@ sudo xbps-install bottom

### Homebrew

Formula available [here](https://formulae.brew.sh/formula/bottom):
[Formula available here](https://formulae.brew.sh/formula/bottom):

```bash
brew install bottom
```

### MacPorts

Available [here](https://ports.macports.org/port/bottom/):
[Available here](https://ports.macports.org/port/bottom/):

```bash
sudo port selfupdate
Expand All @@ -345,7 +345,7 @@ sudo port install bottom

### Chocolatey

Chocolatey packages are located [here](https://chocolatey.org/packages/bottom):
[Chocolatey packages are located here](https://chocolatey.org/packages/bottom):

```bash
choco install bottom
Expand All @@ -361,7 +361,7 @@ scoop install bottom

### winget

The winget package can be found [here](https://github.com/microsoft/winget-pkgs/tree/master/manifests/c/Clement/bottom):
[The winget package can be found here](https://github.com/microsoft/winget-pkgs/tree/master/manifests/c/Clement/bottom):

```bash
winget install bottom
Expand Down
4 changes: 4 additions & 0 deletions src/app/data/time_series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ pub struct TimeSeriesData {
#[cfg(feature = "gpu")]
/// GPU memory data.
pub gpu_mem: HashMap<String, Values>,

/// Temperature data, if needed. A mapping of sensor names to
/// their temperature values.
pub temp: HashMap<String, Values>,
}

impl TimeSeriesData {
Expand Down
3 changes: 3 additions & 0 deletions src/widgets/disk_graph.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//! Code for a disk graph widget.

// TODO: Implement this.
Empty file added src/widgets/mem_value_graph.rs
Empty file.
26 changes: 19 additions & 7 deletions src/widgets/mod.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
pub mod battery_info;
pub mod cpu_graph;
pub mod disk_table;
pub mod mem_graph;
pub mod network_graph;
pub mod process_table;
pub mod temperature_table;
//! The "widgets" of bottom.

mod battery_info;
mod cpu_graph;
mod disk_graph;
mod disk_table;
mod mem_graph;
mod network_graph;
mod process_table;
mod temperature_graph;
mod temperature_table;

pub use battery_info::*;
pub use cpu_graph::*;
pub use disk_graph::*;
pub use disk_table::*;
pub use mem_graph::*;
pub use network_graph::*;
pub use process_table::*;
pub use temperature_graph::*;
pub use temperature_table::*;

/// Whether an event is handled by the current element or not.
pub enum EventHandled {
Handled,
NotHandled,
}
57 changes: 57 additions & 0 deletions src/widgets/temperature_graph.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//! Code for a temperature graph widget.

use std::time::Instant;

use crossterm::event::{KeyEvent, MouseEvent};
use tui::{Frame, layout::Rect};

use crate::app::{App, data::TemperatureType};

use super::EventHandled;

/// A temperature graph widget.
///
/// The current implementation of this uses tuine-style code; this will
/// become the standard later on for all widgets.
#[derive(Default)]
pub struct TemperatureGraph {
current_display_time: u64,
autohide_timer: Option<Instant>,
current_max_temperature: u32,
temperature_unit: TemperatureType,
}

impl TemperatureGraph {
pub fn temperature_unit(mut self, unit: TemperatureType) -> Self {
self.temperature_unit = unit;
self
}

/// How this widget handles key events.
///
/// TODO: This may merge with [`Self::handle_mouse_event`] in the future.
pub fn handle_key_event(event: KeyEvent) -> EventHandled {
EventHandled::NotHandled
}

/// How this widget handles mouse events.
///
/// TODO: This may merge with [`Self::handle_key_event`] in the future.
pub fn handle_mouse_event(event: MouseEvent) -> EventHandled {
EventHandled::NotHandled
}

// /// How to lay out this widget in terms of sizing.
//
// For now, this is not implemented, and we will directly give sizes.
// pub fn layout() {}

/// How to draw this widget.
///
/// This implementation is a bit of a hack/placeholder, in the future we don't want to bring in stuff like [`App`].
pub fn draw(&mut self, frame: &mut Frame<'_>, app_state: &mut App, draw_area: Rect) {
let data = &app_state.data_store.get_data().timeseries_data.temp;

// Inspect the newest entry of each sensor to determine the current max temperature.
}
}
Loading