implemented tui for multiple fans
This commit is contained in:
@@ -136,9 +136,10 @@ impl DellXps9380Guard {
|
|||||||
|
|
||||||
impl EnvironmentGuard for DellXps9380Guard {
|
impl EnvironmentGuard for DellXps9380Guard {
|
||||||
fn suppress(&mut self) -> Result<()> {
|
fn suppress(&mut self) -> Result<()> {
|
||||||
let services = ["tlp", "thermald"];
|
let services = ["tlp", "thermald", "i8kmon"];
|
||||||
for s in services {
|
for s in services {
|
||||||
if Command::new("systemctl").args(["is-active", "--quiet", s]).status()?.success() {
|
if Command::new("systemctl").args(["is-active", "--quiet", s]).status()?.success() {
|
||||||
|
debug!("Suppressing service: {}", s);
|
||||||
Command::new("systemctl").args(["stop", s]).status()?;
|
Command::new("systemctl").args(["stop", s]).status()?;
|
||||||
self.stopped_services.push(s.to_string());
|
self.stopped_services.push(s.to_string());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ pub fn draw_dashboard(
|
|||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
.constraints([
|
.constraints([
|
||||||
Constraint::Length(10), // Gauges
|
Constraint::Length(10), // Gauges
|
||||||
Constraint::Length(3), // Cooling
|
Constraint::Min(4), // Cooling (Increased for multiple fans)
|
||||||
Constraint::Length(3), // CPU State
|
Constraint::Length(3), // CPU State
|
||||||
Constraint::Min(4), // Metadata
|
Constraint::Min(4), // Metadata
|
||||||
])
|
])
|
||||||
@@ -182,22 +182,35 @@ fn draw_cooling(f: &mut Frame, area: Rect, state: &TelemetryState) {
|
|||||||
let inner = block.inner(area);
|
let inner = block.inner(area);
|
||||||
f.render_widget(block, area);
|
f.render_widget(block, area);
|
||||||
|
|
||||||
let fan_info = if state.fans.is_empty() {
|
let mut lines = Vec::new();
|
||||||
"N/A".to_string()
|
|
||||||
} else {
|
// Line 1: Tier
|
||||||
state.fans.iter()
|
lines.push(Line::from(vec![
|
||||||
.map(|rpm| format!("{} RPM", rpm))
|
|
||||||
.collect::<Vec<String>>()
|
|
||||||
.join(" | ")
|
|
||||||
};
|
|
||||||
|
|
||||||
let info = Line::from(vec![
|
|
||||||
Span::styled(" Tier: ", Style::default().fg(C_LAVENDER)),
|
Span::styled(" Tier: ", Style::default().fg(C_LAVENDER)),
|
||||||
Span::styled(&state.fan_tier, Style::default().fg(C_TEAL)),
|
Span::styled(&state.fan_tier, Style::default().fg(C_TEAL)),
|
||||||
Span::styled(" | ", Style::default().fg(C_LAVENDER)),
|
]));
|
||||||
Span::styled(fan_info, Style::default().fg(C_TEXT)),
|
|
||||||
]);
|
// Line 2+: Fans
|
||||||
f.render_widget(Paragraph::new(info), inner);
|
if state.fans.is_empty() {
|
||||||
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled(" Fans: ", Style::default().fg(C_LAVENDER)),
|
||||||
|
Span::styled("N/A", Style::default().fg(C_SUBTEXT)),
|
||||||
|
]));
|
||||||
|
} else if state.fans.len() == 1 {
|
||||||
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled(" Fan: ", Style::default().fg(C_LAVENDER)),
|
||||||
|
Span::styled(format!("{} RPM", state.fans[0]), Style::default().fg(C_TEXT)),
|
||||||
|
]));
|
||||||
|
} else {
|
||||||
|
for (i, rpm) in state.fans.iter().enumerate() {
|
||||||
|
lines.push(Line::from(vec![
|
||||||
|
Span::styled(format!(" Fan {}: ", i + 1), Style::default().fg(C_LAVENDER)),
|
||||||
|
Span::styled(format!("{} RPM", rpm), Style::default().fg(C_TEXT)),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
f.render_widget(Paragraph::new(lines), inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_cpu_state(f: &mut Frame, area: Rect, state: &TelemetryState) {
|
fn draw_cpu_state(f: &mut Frame, area: Rect, state: &TelemetryState) {
|
||||||
|
|||||||
Reference in New Issue
Block a user