mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 21:01:54 +05:30
refactor: move system info to control center
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import { createPoll } from "ags/time";
|
||||
|
||||
export const CPU = () => {
|
||||
const cpu = createPoll("", 5000, [
|
||||
"bash",
|
||||
"-c",
|
||||
"cat /sys/class/thermal/thermal_zone*/temp",
|
||||
]);
|
||||
|
||||
return (
|
||||
<box cssClasses={["pill"]} spacing={5}>
|
||||
<image iconName="fa-cpu-symbolic" />
|
||||
<label label={cpu((val) => `${parseInt(val) / 1000} °C`)} />
|
||||
</box>
|
||||
);
|
||||
};
|
@@ -1,12 +0,0 @@
|
||||
import { createPoll } from "ags/time";
|
||||
|
||||
export const GPU = () => {
|
||||
const gpu = createPoll("", 5000, ["bash", "-c", "supergfxctl -g"]);
|
||||
|
||||
return (
|
||||
<box cssClasses={["pill"]} spacing={5}>
|
||||
<image iconName="fa-video-card-symbolic" />
|
||||
<label label={gpu((val) => val)} />
|
||||
</box>
|
||||
);
|
||||
};
|
@@ -1,12 +1,8 @@
|
||||
import { Astal, Gdk } from "ags/gtk4";
|
||||
import app from "ags/gtk4/app";
|
||||
import { Battery } from "./battery";
|
||||
import { CPU } from "./cpu";
|
||||
import { GPU } from "./gpu";
|
||||
import { Launcher } from "./launcher";
|
||||
import { Network } from "./network";
|
||||
import { Profile } from "./profile";
|
||||
import { Tailscale } from "./tailscale";
|
||||
import { Time } from "./time";
|
||||
import { Tray } from "./tray";
|
||||
import { WorkspaceButton } from "./workspace";
|
||||
@@ -14,7 +10,7 @@ import { WorkspaceButton } from "./workspace";
|
||||
export const WINDOW_NAME = "bar";
|
||||
|
||||
export const Bar = (gdkmonitor: Gdk.Monitor) => {
|
||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
|
||||
const { TOP } = Astal.WindowAnchor;
|
||||
|
||||
return (
|
||||
<window
|
||||
@@ -23,16 +19,15 @@ export const Bar = (gdkmonitor: Gdk.Monitor) => {
|
||||
cssClasses={["Bar"]}
|
||||
gdkmonitor={gdkmonitor}
|
||||
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
||||
anchor={TOP | LEFT | RIGHT}
|
||||
anchor={TOP}
|
||||
widthRequest={1200}
|
||||
application={app}
|
||||
>
|
||||
<centerbox>
|
||||
<box spacing={10} $type="start">
|
||||
<Launcher windowName="launcher" icon="nix-symbolic" />
|
||||
<CPU />
|
||||
<GPU />
|
||||
<Profile />
|
||||
<Tailscale />
|
||||
<Network />
|
||||
<Battery />
|
||||
</box>
|
||||
|
||||
<box spacing={10} $type="center">
|
||||
@@ -40,8 +35,6 @@ export const Bar = (gdkmonitor: Gdk.Monitor) => {
|
||||
</box>
|
||||
|
||||
<box spacing={10} $type="end">
|
||||
<Network />
|
||||
<Battery />
|
||||
<Tray />
|
||||
<Time />
|
||||
<Launcher windowName="control-center" icon="fa-ghost-symbolic" />
|
||||
|
@@ -1,17 +0,0 @@
|
||||
import { createPoll } from "ags/time";
|
||||
|
||||
export const Profile = () => {
|
||||
const profile = createPoll("", 5000, ["bash", "-c", "asusctl profile -p"]);
|
||||
|
||||
return (
|
||||
<box cssClasses={["pill"]} spacing={5}>
|
||||
<image iconName="fa-speed-symbolic" />
|
||||
<label
|
||||
label={profile((val) => {
|
||||
const data = val.split(" ");
|
||||
return data[data.length - 1];
|
||||
})}
|
||||
/>
|
||||
</box>
|
||||
);
|
||||
};
|
@@ -1,22 +0,0 @@
|
||||
import { createPoll } from "ags/time";
|
||||
|
||||
export const Tailscale = () => {
|
||||
const tailscale = createPoll("", 5000, [
|
||||
"bash",
|
||||
"-c",
|
||||
"tailscale ping homelab",
|
||||
]);
|
||||
|
||||
return (
|
||||
<box cssClasses={["pill"]} spacing={5}>
|
||||
<image iconName="fa-home-symbolic" />
|
||||
|
||||
<label
|
||||
label={tailscale((val) => {
|
||||
const data = val.split(" ");
|
||||
return data[data.length - 1];
|
||||
})}
|
||||
/>
|
||||
</box>
|
||||
);
|
||||
};
|
@@ -5,7 +5,7 @@ export const Time = () => {
|
||||
const time = createPoll(
|
||||
"",
|
||||
1000,
|
||||
() => GLib.DateTime.new_now_local().format("%a %b %d - %I:%M:%S %p")!,
|
||||
() => GLib.DateTime.new_now_local().format("%I:%M %p")!,
|
||||
);
|
||||
|
||||
return <label cssClasses={["pill"]} label={time} />;
|
||||
|
Reference in New Issue
Block a user