Network#

class ignis.services.network.NetworkService(*args: Any, **kwargs: Any)#

A Network service. Uses NetworkManager.

gproperty wifi: Wifi#
  • read-only

The Wi-Fi object.

gproperty ethernet: Ethernet#
  • read-only

The Ethernet object.

gproperty vpn: Vpn#
  • read-only

The Vpn object.

class ignis.services.network.Wifi(client: gi.repository.NM.Client)#

The class for controlling Wi-Fi devices.

signal new_device#

Emitted when a new Wi-FI device is added.

Parameters:

device (WifiDevice) -- An instance of the device.

gproperty devices: list[WifiDevice]#
  • read-only

A list of Wi-Fi devices.

gproperty is_connected: bool#
  • read-only

Whether at least one Wi-Fi device is connected to the network.

gproperty icon_name: str#
  • read-only

The icon name of the first device in the list.

gproperty enabled: bool#
  • read-write

Whether Wi-Fi is enabled.

class ignis.services.network.Ethernet(client: gi.repository.NM.Client)#

The class for controlling Ethernet devices.

signal new_device#

Emitted when a new Ethernet device is added.

Parameters:

device (EthernetDevice) -- An instance of the device.

gproperty devices: list[EthernetDevice]#
  • read-only

A list of Ethernet devices.

gproperty is_connected: bool#
  • read-only

Whether at least one Ethernet device is connected to the network.

gproperty icon_name: str#
  • read-only

The general icon name for all devices, depends on is_connected property.

class ignis.services.network.Vpn(client: gi.repository.NM.Client)#

The class for controlling VPN connections.

signal new_connection#

Emitted when a new VPN connection is added.

Parameters:

connection (VpnConnection) -- An instance of the VPN connection.

signal new_active_connection#

Emitted when a VPN connection is activated.

Parameters:

connection (VpnConnection) -- An instance of the newly activated VPN connection.

gproperty connections: list[VpnConnection]#
  • read-only

A list of all VPN connections.

gproperty active_connections: list[VpnConnection]#
  • read-only

A list of active VPN connections.

gproperty active_vpn_id: str | None#
  • read-only

The id (name) of the first active vpn connection.

gproperty is_connected: bool#
  • read-only

Whether at least one VPN connection is active.

gproperty icon_name: str#
  • read-only

The general icon name for all vpn connections, depends on is_connected property.

class ignis.services.network.WifiDevice(device: gi.repository.NM.DeviceWifi, client: gi.repository.NM.Client)#

A Wifi device.

signal removed#

Emitted when this Wi-Fi device is removed.

signal new_access_point#

Emitted when a new access point is added.

Parameters:

access_point (WifiAccessPoint) -- An instance of the access point.

gproperty access_points: list[WifiAccessPoint]#
  • read-only

A list of access points (Wi-FI networks).

gproperty ap: WifiAccessPoint#
  • read-only

The currently active access point.

gproperty state: str | None#
  • read-only

The current state of the device or None if unknown.

gproperty is_connected: bool#
  • read-only

Whether the device is connected to a Wi-Fi network.

async scan() None#

Scan for Wi-Fi networks.

Return type:

None

class ignis.services.network.EthernetDevice(device: gi.repository.NM.DeviceEthernet, client: gi.repository.NM.Client)#

An Ethernet device.

signal removed#

Emitted when this Ethernet device is removed.

gproperty carrier: bool#
  • read-only

Whether the device has a carrier.

gproperty perm_hw_address: str#
  • read-only

The permanent hardware (MAC) address of the device.

gproperty speed: int#
  • read-only

The speed of the device.

gproperty state: str | None#
  • read-only

The current state of the device or None if unknown.

gproperty is_connected: bool#
  • read-only

Whether the device is connected to the network.

gproperty name: str | None#
  • read-only

The name of the connection or None if unknown.

async connect_to() None#

Connect this Ethernet device to the network.

Return type:

None

async disconnect_from() None#

Disconnect this Ethernet device from the network.

Return type:

None

class ignis.services.network.WifiAccessPoint(point: gi.repository.NM.AccessPoint, client: gi.repository.NM.Client, device: gi.repository.NM.DeviceWifi)#

A Wi-Fi access point (Wi-Fi network).

signal removed#

Emitted when this access point is removed.

gproperty point: gi.repository.NM.AccessPoint#
  • read-only

An instance of NM.AccessPoint.

gproperty bandwidth: int#
  • read-only

The channel bandwidth announced by the access point, in MHz.

gproperty bssid: str#
  • read-only

The BSSID of the access point.

gproperty frequency: int#
  • read-only

The frequency of the access point, in MHz.

gproperty last_seen: int#
  • read-only

The timestamp for the last time the access point was found in scan results.

gproperty max_bitrate: int#
  • read-only

The maximum bit rate of the access point, in kbit/s.

gproperty ssid: str | None#
  • read-only

The SSID of the access point, or None if it is not known.

gproperty strength: int#
  • read-only

The current signal strength of the access point, from 0 to 100.

gproperty icon_name: str#
  • read-only

The current icon name for the access point. Depends on signal strength and current connection status.

gproperty security: Literal['WPA1', 'WPA2/WPA3'] | None#
  • read-only

The security protocol of the access point (WPA1, WPA2/WPA3).

gproperty psk: str | None#
  • read-write

The stored Pre-shared key (password) for the access point. None if there is no a saved psk for this access point.

Warning

After setting this property, you have to manually call commit_changes_async() to save changes to the disk.

gproperty is_connected: bool#
  • read-only

Whether the device is currently connected to this access point.

async commit_changes_async() None#

Asynchronously commit changes to the connection.

Return type:

None

async connect_to(password: str | None = None) gi.repository.NM.ActiveConnection#

Asynchronously connect to this access point.

Return type:

ActiveConnection

Args

password: Password to use. This has an effect only if the access point requires a password.

async connect_to_graphical() None#

Display a graphical dialog to connect to the access point. The dialog will be shown only if the access point requires a password. This function is asynchronous.

Return type:

None

async disconnect_from() None#

Asynchronously disconnect from this access point.

Return type:

None

clear_secrets() None#

Clear a stored secret. This will reset security settings (PSK and security protocol). :rtype: None

Warning

After calling this method, you have to manually call commit_changes_async() to save changes to the disk.

async forget() None#

Forget (delete) the stored connection.

Return type:

None

class ignis.services.network.VpnConnection(connection: NM.Connection | NM.ActiveConnection, client: gi.repository.NM.Client)#

A VPN connection.

signal removed#

Emitted when this VPN connection is removed.

gproperty is_connected: bool#
  • read-only

Whether the device is connected to the network.

gproperty name: str | None#
  • read-only

The id (name) of the vpn connection or None if unknown.

async toggle_connection() None#

Toggle this VPN depending on it's is_connected property

Return type:

None

async connect_to() None#

Connect to this VPN.

Return type:

None

async disconnect_from() None#

Disconnect from this VPN.

Return type:

None