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