31 lines
979 B
JavaScript
Executable File
31 lines
979 B
JavaScript
Executable File
const network = await Service.import('network')
|
|
|
|
export default function WifiIndicator() {
|
|
return Widget.Box({
|
|
child: Widget.EventBox({
|
|
child: Widget.Icon({
|
|
icon: 'network-wireless-disconnected-symbolic',
|
|
}),
|
|
|
|
setup: self => self.hook(network.wifi, () => {
|
|
self.child.icon = network.wifi.icon_name == 'network-wireless-disabled-symbolic' ? 'network-wireless-disconnected-symbolic' : network.wifi.icon_name
|
|
self.tooltip_text = network.wifi.ssid ? network.wifi.ssid : network.wifi.internet
|
|
}),
|
|
|
|
tooltip_text: 'disconnected',
|
|
}),
|
|
})
|
|
}
|
|
|
|
// 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'),
|
|
// })
|