feat: add cpu temp widget

This commit is contained in:
tux
2025-06-09 18:23:58 +05:30
parent 9b04b5bd9a
commit 78270dbed7
2 changed files with 17 additions and 0 deletions

15
widgets/bar/cpu.tsx Normal file
View File

@@ -0,0 +1,15 @@
import { bind, Variable } from "astal";
export const CPU = () => {
const cpu = Variable("").poll(5000, [
"bash",
"-c",
"cat /sys/class/thermal/thermal_zone*/temp",
]);
return (
<box cssClasses={["pill"]}>
<label label={bind(cpu).as((val) => `CPU: ${parseInt(val) / 1000} °C`)} />
</box>
);
};