more stuff yay
This commit is contained in:
parent
340508ca57
commit
eded3f1d71
@ -1,3 +1,4 @@
|
|||||||
|
use std::time::Duration;
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use sysinfo::{System, SystemExt, ProcessExt, Pid, Process, Uid};
|
use sysinfo::{System, SystemExt, ProcessExt, Pid, Process, Uid};
|
||||||
|
|
||||||
@ -35,6 +36,8 @@ impl Application {
|
|||||||
pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
|
pub fn new(cc: &eframe::CreationContext<'_>) -> Self {
|
||||||
cc.egui_ctx.set_visuals(egui::Visuals::dark());
|
cc.egui_ctx.set_visuals(egui::Visuals::dark());
|
||||||
|
|
||||||
|
cc.egui_ctx.request_repaint_after(Duration::from_secs(1));
|
||||||
|
|
||||||
if let Some(storage) = cc.storage {
|
if let Some(storage) = cc.storage {
|
||||||
return eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default();
|
return eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default();
|
||||||
}
|
}
|
||||||
@ -73,7 +76,8 @@ impl App for Application {
|
|||||||
if self.current_pid.is_some() {
|
if self.current_pid.is_some() {
|
||||||
let process_or_none = self.info.process(Pid::from(self.current_pid.unwrap()));
|
let process_or_none = self.info.process(Pid::from(self.current_pid.unwrap()));
|
||||||
if process_or_none.is_none() {
|
if process_or_none.is_none() {
|
||||||
self.current_pid = None
|
self.current_pid = None;
|
||||||
|
self.kill_current = false
|
||||||
} else {
|
} else {
|
||||||
let process = process_or_none.unwrap();
|
let process = process_or_none.unwrap();
|
||||||
egui::TopBottomPanel::bottom("process_bottom_panel").show(ctx, |ui| {
|
egui::TopBottomPanel::bottom("process_bottom_panel").show(ctx, |ui| {
|
||||||
@ -105,8 +109,10 @@ impl App for Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
|
ui.heading(format!("System name: {}", self.info.name().unwrap()));
|
||||||
ui.heading(format!("Total memory: {} bytes", self.info.total_memory()));
|
ui.heading(format!("Total memory: {} bytes", self.info.total_memory()));
|
||||||
ui.heading(format!("Free memory: {} bytes", self.info.free_memory()));
|
ui.heading(format!("Free memory: {} bytes", self.info.free_memory()));
|
||||||
|
ui.heading("Processes:");
|
||||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
let mut values = Vec::from_iter(self.info.processes().values());
|
let mut values = Vec::from_iter(self.info.processes().values());
|
||||||
values.sort_by(|a, b| a.user_id().unwrap().cmp(b.user_id().unwrap()));
|
values.sort_by(|a, b| a.user_id().unwrap().cmp(b.user_id().unwrap()));
|
||||||
|
Loading…
Reference in New Issue
Block a user