mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 12:51:54 +05:30
feat: add tailscale widget
This commit is contained in:
@@ -2,6 +2,7 @@ import { App, Astal, Gdk } from "astal/gtk4";
|
||||
import { FocusedClient, WorkspaceButton } from "./workspace";
|
||||
import { Battery } from "./battery";
|
||||
import { Launcher } from "./launcher";
|
||||
import { Tailscale } from "./tailscale";
|
||||
|
||||
export const WINDOW_NAME = "bar";
|
||||
|
||||
@@ -41,5 +42,10 @@ const Center = () => {
|
||||
};
|
||||
|
||||
const End = () => {
|
||||
return <Battery />;
|
||||
return (
|
||||
<box spacing={15}>
|
||||
<Tailscale />
|
||||
<Battery />
|
||||
</box>
|
||||
);
|
||||
};
|
||||
|
20
widget/bar/tailscale.tsx
Normal file
20
widget/bar/tailscale.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { bind, Variable } from "astal";
|
||||
|
||||
export const Tailscale = () => {
|
||||
const tailscale = Variable("").poll(5000, [
|
||||
"bash",
|
||||
"-c",
|
||||
"tailscale ping vega",
|
||||
]);
|
||||
|
||||
return (
|
||||
<box cssClasses={["tailscale"]}>
|
||||
<label
|
||||
label={bind(tailscale).as((val) => {
|
||||
const data = val.split(" ");
|
||||
return data[data.length - 1];
|
||||
})}
|
||||
/>
|
||||
</box>
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user