feat: add widget for gpu and cpu profile

This commit is contained in:
tux
2025-06-09 06:33:50 +05:30
parent 3e18ba6f82
commit 9b04b5bd9a
3 changed files with 31 additions and 0 deletions

11
widgets/bar/gpu.tsx Normal file
View File

@@ -0,0 +1,11 @@
import { bind, Variable } from "astal";
export const GPU = () => {
const gpu = Variable("").poll(5000, ["bash", "-c", "supergfxctl -g"]);
return (
<box cssClasses={["pill"]}>
<label label={bind(gpu).as((val) => `GPU: ${val}`)} />
</box>
);
};

View File

@@ -4,6 +4,8 @@ import { Battery } from "./battery";
import { Tailscale } from "./tailscale";
import { Time } from "./time";
import { Network } from "./network";
import { Profile } from "./profile";
import { GPU } from "./gpu";
export const WINDOW_NAME = "bar";
@@ -45,6 +47,8 @@ const End = () => {
return (
<box spacing={10}>
<Network />
<GPU />
<Profile />
<Tailscale />
<Battery />
<Time />

16
widgets/bar/profile.tsx Normal file
View File

@@ -0,0 +1,16 @@
import { bind, Variable } from "astal";
export const Profile = () => {
const profile = Variable("").poll(5000, ["bash", "-c", "asusctl profile -p"]);
return (
<box cssClasses={["pill"]}>
<label
label={bind(profile).as((val) => {
const data = val.split(" ");
return "P: " + data[data.length - 1];
})}
/>
</box>
);
};