mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 21:01:54 +05:30
feat: add cpu temp widget
This commit is contained in:
15
widgets/bar/cpu.tsx
Normal file
15
widgets/bar/cpu.tsx
Normal 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>
|
||||||
|
);
|
||||||
|
};
|
@@ -6,6 +6,7 @@ import { Time } from "./time";
|
|||||||
import { Network } from "./network";
|
import { Network } from "./network";
|
||||||
import { Profile } from "./profile";
|
import { Profile } from "./profile";
|
||||||
import { GPU } from "./gpu";
|
import { GPU } from "./gpu";
|
||||||
|
import { CPU } from "./cpu";
|
||||||
|
|
||||||
export const WINDOW_NAME = "bar";
|
export const WINDOW_NAME = "bar";
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ const End = () => {
|
|||||||
return (
|
return (
|
||||||
<box spacing={10}>
|
<box spacing={10}>
|
||||||
<Network />
|
<Network />
|
||||||
|
<CPU />
|
||||||
<GPU />
|
<GPU />
|
||||||
<Profile />
|
<Profile />
|
||||||
<Tailscale />
|
<Tailscale />
|
||||||
|
Reference in New Issue
Block a user