2024-12-27 15:42:51 +03:00
|
|
|
import { bind } from "astal"
|
|
|
|
import Network from "gi://AstalNetwork"
|
2025-03-21 00:12:52 +03:00
|
|
|
import { execAsync } from "astal/process"
|
2024-12-27 15:42:51 +03:00
|
|
|
|
|
|
|
export default function Wifi() {
|
|
|
|
const network = Network.get_default()
|
|
|
|
const wifi = bind(network, "wifi")
|
|
|
|
|
|
|
|
return <box visible={wifi.as(Boolean)}>
|
|
|
|
{wifi.as(wifi => wifi && (
|
2025-03-21 00:12:52 +03:00
|
|
|
<button
|
2024-12-27 15:42:51 +03:00
|
|
|
className="Wifi"
|
2025-03-21 00:12:52 +03:00
|
|
|
onClicked={() => {execAsync("kitty nmtui")}}>
|
|
|
|
<box>
|
|
|
|
<icon
|
|
|
|
tooltipText={bind(wifi, "ssid").as(String)}
|
|
|
|
icon={bind(wifi, "iconName")}
|
|
|
|
/>
|
|
|
|
<label
|
|
|
|
label={bind(wifi, "ssid").as(String)}
|
|
|
|
/>
|
|
|
|
</box>
|
|
|
|
</button>
|
2024-12-27 15:42:51 +03:00
|
|
|
))}
|
|
|
|
</box>
|
|
|
|
}
|