added a little system resource monitor to the info pane, that shows CPU

usage and RAM usage and refresheds every second.
This commit is contained in:
2026-08-17 14:26:55 -05:00
parent fa4b518437
commit e28306d07d
2 changed files with 30 additions and 1 deletions
+14 -1
View File
@@ -1815,7 +1815,7 @@ impl ModuleLoader {
std::fs::write(path, contents).is_ok()
});
engine.register_fn("find_file", |path: PathBuf, filename: String| -> String {
for entry in walkdir::WalkDir::new(path).max_depth(10) {
for entry in walkdir::WalkDir::new(path).max_depth(50) {
if let Ok(entry) = entry {
if entry
.file_name()
@@ -1829,6 +1829,19 @@ impl ModuleLoader {
String::new()
});
engine.register_fn("execute", |cmd: &str| -> String {
let out_string;
if let Ok(output) = Command::new("sh").arg("-c").arg(cmd).output() {
if output.status.success() {
out_string = format!("[success] {}", String::from_utf8_lossy(&output.stdout));
} else {
out_string = format!("[error] {}", String::from_utf8_lossy(&output.stderr));
}
} else {
out_string = "[error] failed to run command".to_string();
}
return out_string;
});
Self {
engine: Arc::new(engine),
commands: HashMap::new(),