Network
properties
- connectivity:- "unknown" | "none" | "portal" | "limited" | "full"
- primary:- "wifi" | "wired"
- wired:- Wired
- wifi:- Wifi
- vpn:- Vpn
methods
- toggleWifi:- () => void
Wifi
properties
- ssid:- string
- strength:- number0..100
- frequency:- number
- internet:- "connected" | "connecting" | "disconnected"
- enabled:- boolean
- access-points:- AccessPoint
- icon-name:- string
- state:- string: NM.DeviceState as lowercase string
methods
- scan:- () => void
AccessPoint
access points are not a GObjects, just a regular js objects meaning you can’t bind to it or use notify::prop signal
properties
- bssid:- string
- address:- string
- lastSeen:- number
- ssid:- string
- active:- boolean
- strength:- number
- frequency:- number
- iconName:- stringicon name representing its signal strength
Wired
- internet:- "connected" | "connecting" | "disconnected"
- state:- "enabled" | "disabled" | "unknown"
- state:- string: NM.DeviceState as lowercase string
- icon-name:- string
Vpn
signals
- connection-added:- (uuid: string)
- connection-removed:- (uuid: string)
properties
- connections:- VpnConnection[]
- activated-connections:- VpnConnection[]
methods
- getConnection:- (uuid: string) => VpnConnection
VpnConnection
properties
- uuid:- string
- id:- string: The unique name of the connection
- state:- "connected" | "connecting" | "disconnecting" | "disconnected"
- vpn-state:- "unknown" | "prepare" | "needs_auth" | "connect" | "ip_config" | "activated" | "failed" | "disconnected"
- icon-name:- string
methods
- setConnection:- (connect: boolean) => void
Example Widget
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'),})