feat: move status-bar to seperate repository, initial commit

This commit is contained in:
2025-09-24 21:11:28 -07:00
commit 68142eac7c
24 changed files with 664 additions and 0 deletions

19
widget/cpu-widget.tsx Normal file
View File

@@ -0,0 +1,19 @@
import { bind, GLib, Variable } from "astal";
import { calc_cpu_usage, get_cpu_snapshot } from "./cpu";
let s1 = get_cpu_snapshot();
let cpu_usage_percent = Variable(0);
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, () => {
const s2 = get_cpu_snapshot();
cpu_usage_percent.set(calc_cpu_usage(s1, s2));
s1 = s2;
return true;
});
export default function Cpu() {
return <box className="status-box">
<label label={bind(cpu_usage_percent).as((u) => `${u}% `)} />
</box>
}