Skip to content

Commit

Permalink
fixes #14 disk space mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdenasser committed Nov 6, 2024
1 parent 21c19df commit 332bafb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ <h3>Process Management</h3>
<h2>Download for macOS</h2>
<p class="download-subtitle">Choose the version that matches your Mac</p>
<div class="download-options">
<a href="https://github.com/Abdenasser/neohtop/releases/download/v1.0.3/NeoHtop-intel.dmg"
<a href="https://github.com/Abdenasser/neohtop/releases/download/v1.0.4/NeoHtop-intel.dmg"
class="download-button intel">
<span class="icon">💻</span>
<div class="button-text">
<span class="primary">Intel Mac</span>
<span class="secondary">For Intel-based Macs</span>
</div>
</a>
<a href="https://github.com/Abdenasser/neohtop/releases/download/v1.0.3/NeoHtop-silicon.dmg"
<a href="https://github.com/Abdenasser/neohtop/releases/download/v1.0.4/NeoHtop-silicon.dmg"
class="download-button silicon">
<span class="icon">🍎</span>
<div class="button-text">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macos-task-manager",
"version": "1.0.3",
"version": "1.0.4",
"description": "",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "macos-task-manager"
version = "1.0.3"
version = "1.0.4"
description = "A Tauri App"
authors = ["you"]
edition = "2021"
Expand Down
21 changes: 13 additions & 8 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,19 @@ async fn get_processes(state: State<'_, AppState>) -> Result<(Vec<ProcessInfo>,

*last_update = (current_time, current_rx, current_tx);

// Calculate total disk usage
let disk_stats = sys.disks().iter().fold((0, 0, 0), |acc, disk| {
(
acc.0 + disk.total_space(),
acc.1 + disk.total_space() - disk.available_space(),
acc.2 + disk.available_space()
)
});
// Calculate total disk usage - only for physical disks
let disk_stats = sys.disks().iter()
.filter(|disk| {
// Filter for physical disks - typically those mounted at "/"
disk.mount_point() == std::path::Path::new("/")
})
.fold((0, 0, 0), |acc, disk| {
(
acc.0 + disk.total_space(),
acc.1 + disk.total_space() - disk.available_space(),
acc.2 + disk.available_space()
)
});

system_stats = SystemStats {
cpu_usage: sys.cpus().iter().map(|cpu| cpu.cpu_usage()).collect(),
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "NeoHtop",
"version": "1.0.3"
"version": "1.0.4"
},
"tauri": {
"allowlist": {
Expand Down

0 comments on commit 332bafb

Please sign in to comment.