25 lines
584 B
JavaScript
25 lines
584 B
JavaScript
const network = await Service.import("network")
|
|
const WifiIndicator = () => Widget.Box({
|
|
children: [
|
|
Widget.Icon({
|
|
icon: network.wifi.bind('icon_name'),
|
|
}),
|
|
Widget.Label({
|
|
label: network.wifi.bind('ssid')
|
|
.as(ssid => ssid || 'Unknown'),
|
|
}),
|
|
],
|
|
})
|
|
|
|
const WiredIndicator = () => Widget.Icon({
|
|
icon: network.wired.bind('icon_name'),
|
|
})
|
|
|
|
const NetworkIndicator = () => Widget.Stack({
|
|
children: {
|
|
wifi: WifiIndicator(),
|
|
wired: WiredIndicator(),
|
|
},
|
|
shown: network.bind('primary').as(p => p || 'wifi'),
|
|
})
|
|
export { NetworkIndicator };
|