Compare commits

...
Sign in to create a new pull request.
Author SHA1 Message Date
c1d46a4be0
build: update deps 2026-10-07 20:35:52 -07:00
ba96aa4d6b
feat: reduce parrelization, maximize LTO
this reduces the binary size from 22MB to 15MB
(via `nix build`, as reported by `eza`)
2026-09-25 11:30:21 -07:00
3fa2163366
refactor: converge naming from main branch 2026-08-18 14:22:37 -07:00
6 changed files with 317 additions and 306 deletions

574
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -12,3 +12,7 @@ sysinfo = "0.39.6"
[dependencies.iced]
version = "0.14.0"
features = [ "canvas", "smol" ]
[profile.release]
lto = true
codegen-units = 1

23
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": {
"crane": {
"locked": {
"lastModified": 1785782307,
"narHash": "sha256-MPaRdVkf6zZP5fCPxYCi8Dr4pZzgmXzg8T9nVEbp3Mw=",
"lastModified": 1790899423,
"narHash": "sha256-THGtz65UGJU+sonZidRboyCMk+9DclpMF7pwL4uDV4M=",
"owner": "ipetkov",
"repo": "crane",
"rev": "2c71e194474d13de031d729b729c968ddbe3507f",
"rev": "47b6b27ed9a3a9181415e4367d0c30ab2a0e0250",
"type": "github"
},
"original": {
@ -35,18 +35,15 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1785747939,
"narHash": "sha256-D740uKsMbgsfK2oaDenJLLPIZfq7W0/g4KN/Fls8eKs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "104240a772428cc2e20d8fd86c9ddbb886bbaff2",
"type": "github"
"lastModified": 1791260994,
"narHash": "sha256-MFBjw66d4h06MvpW6lIl7RwarLteD0sk859CncGwb1Q=",
"rev": "151fa4e8ddfdd8dd25d945ad94ed54a13de9f6e4",
"type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1086391.151fa4e8ddfd/nixexprs.tar.zst?lastModified=1791260994&rev=151fa4e8ddfdd8dd25d945ad94ed54a13de9f6e4"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
"type": "tarball",
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"
}
},
"root": {

View file

@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
crane.url = "github:ipetkov/crane";

View file

@ -7,21 +7,21 @@ use crate::app;
const CYAN: Color = Color::from_rgb8(0, 255, 255);
#[derive(Default)]
pub struct CpuGraph {
pub struct Graph {
pub cache: canvas::Cache,
timeline: VecDeque<f32>,
}
impl CpuGraph {
pub fn update(&mut self, usage: f32) {
self.timeline.push_back(usage);
impl Graph {
pub fn update(&mut self, value: f32) {
self.timeline.push_back(value);
if self.timeline.len() > 1000 {
self.timeline.pop_front();
}
}
}
impl canvas::Program<app::Message, Theme, Renderer> for CpuGraph {
impl canvas::Program<app::Message, Theme, Renderer> for Graph {
type State = ();
fn draw(
&self,

View file

@ -1,19 +1,19 @@
use iced::{
Color, Element, Length, Renderer, Task, Theme, application, futures::SinkExt, stream::channel,
theme, widget,
Color, Element, Length, Renderer, Task, Theme, application, futures::SinkExt, stream, theme,
widget,
};
use smol::Timer;
use crate::app::cpu_graph::CpuGraph;
use crate::app::graph::Graph;
mod cpu_graph;
mod graph;
enum Message {
Cpu(f32),
}
struct State {
cpu_graph: CpuGraph,
cpu_graph: Graph,
}
impl State {
@ -23,7 +23,7 @@ impl State {
cpu_graph: Default::default(),
},
Task::run(
channel(1, async |mut sender| {
stream::channel(1, async |mut sender| {
let mut sys = sysinfo::System::new();
let refreshes = sysinfo::RefreshKind::nothing()
.with_cpu(sysinfo::CpuRefreshKind::nothing().with_cpu_usage());