mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 21:01:54 +05:30
feat: add network widget
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
apps
|
apps
|
||||||
battery
|
battery
|
||||||
tray
|
tray
|
||||||
|
network
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
apps
|
apps
|
||||||
battery
|
battery
|
||||||
tray
|
tray
|
||||||
|
network
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@@ -3,6 +3,7 @@ import { FocusedClient, WorkspaceButton } from "./workspace";
|
|||||||
import { Battery } from "./battery";
|
import { Battery } from "./battery";
|
||||||
import { Tailscale } from "./tailscale";
|
import { Tailscale } from "./tailscale";
|
||||||
import { Time } from "./time";
|
import { Time } from "./time";
|
||||||
|
import { Network } from "./network";
|
||||||
|
|
||||||
export const WINDOW_NAME = "bar";
|
export const WINDOW_NAME = "bar";
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ const Center = () => {
|
|||||||
const End = () => {
|
const End = () => {
|
||||||
return (
|
return (
|
||||||
<box spacing={10}>
|
<box spacing={10}>
|
||||||
|
<Network />
|
||||||
<Tailscale />
|
<Tailscale />
|
||||||
<Battery />
|
<Battery />
|
||||||
<Time />
|
<Time />
|
||||||
|
21
widgets/bar/network.tsx
Normal file
21
widgets/bar/network.tsx
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { bind } from "astal";
|
||||||
|
import AstalNetwork from "gi://AstalNetwork";
|
||||||
|
|
||||||
|
export const Network = () => {
|
||||||
|
const network = AstalNetwork.get_default();
|
||||||
|
const wifi = bind(network, "wifi");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<box cssClasses={["pill"]} visible={wifi.as(Boolean)}>
|
||||||
|
{wifi.as(
|
||||||
|
(wifi) =>
|
||||||
|
wifi && (
|
||||||
|
<box spacing={10}>
|
||||||
|
<image iconName={bind(wifi, "iconName")} />
|
||||||
|
<label label={bind(wifi, "ssid")} />
|
||||||
|
</box>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</box>
|
||||||
|
);
|
||||||
|
};
|
Reference in New Issue
Block a user