Network#

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

A Network service. Uses NetworkManager.

property wifi: Wifi#
  • read-only

The Wi-Fi object.

property ethernet: Ethernet#
  • read-only

The Ethernet object.

property vpn: Vpn#
  • read-only

The Vpn object.

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

The class for controlling Wi-Fi devices.

new_device(*args)#

Emitted when a new Wi-FI device is added.

Parameters:

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

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

A list of Wi-Fi devices.

property is_connected: bool#
  • read-only

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

property icon_name: str#
  • read-only

The icon name of the first device in the list.

property 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.

new_device(*args)#

Emitted when a new Ethernet device is added.

Parameters:

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

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

A list of Ethernet devices.

property is_connected: bool#
  • read-only

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

property 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.

new_connection(*args)#

Emitted when a new VPN connection is added.

Parameters:

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

new_active_connection(*args)#

Emitted when a VPN connection is activated.

Parameters:

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

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

A list of all VPN connections.

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

A list of active VPN connections.

property active_vpn_id: str | None#
  • read-only

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

property is_connected: bool#
  • read-only

Whether at least one VPN connection is active.

property 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.

removed()#

Emitted when this Wi-Fi device is removed.

new_access_point(*args)#

Emitted when a new access point is added.

Parameters:

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

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

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

property ap: WifiAccessPoint#
  • read-only

The currently active access point.

property state: str | None#
  • read-only

The current state of the device or None if unknown.

property is_connected: bool#
  • read-only

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

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.

removed()#

Emitted when this Ethernet device is removed.

property carrier: bool#
  • read-only

Whether the device has a carrier.

property perm_hw_address: str#
  • read-only

The permanent hardware (MAC) address of the device.

property speed: int#
  • read-only

The speed of the device.

property state: str | None#
  • read-only

The current state of the device or None if unknown.

property is_connected: bool#
  • read-only

Whether the device is connected to the network.

property name: str | None#
  • read-only

The name of the connection or None if unknown.

connect_to() None#

Connect this Ethernet device to the network.

Return type:

None

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).

removed()#

Emitted when this access point is removed.

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

An instance of NM.AccessPoint.

property bandwidth: int#
  • read-only

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

property bssid: str#
  • read-only

The BSSID of the access point.

property frequency: int#
  • read-only

The frequency of the access point, in MHz.

property last_seen: int#
  • read-only

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

property max_bitrate: int#
  • read-only

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

property ssid: str | None#
  • read-only

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

property strength: int#
  • read-only

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

property icon_name: str#
  • read-only

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

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

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

property 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.

property is_connected: bool#
  • read-only

Whether the device is currently connected to this access point.

commit_changes_async(callback: Callable | None = None) None#

Asynchronously commit changes to the connection.

Parameters:

callback (Callable | None, default: None) -- A function to call when the changes committing is complete. The function will receive self and a boolean value: True on success, False on failure.

Return type:

None

connect_to(password: str | None = None, callback: Callable | None = None) None#

Asynchronously connect to this access point.

Return type:

None

Args

password: Password to use. This has an effect only if the access point requires a password. callback: A function to call when connection is established or added. The function will receive self and an instance of NM.ActiveConnection as arguments.

connect_to_graphical(callback: Callable | None = None) 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.

Parameters:

callback (Callable | None, default: None) -- A function to call when connection is established or added. The function will receive self and an instance of NM.ActiveConnection as arguments.

Return type:

None

disconnect_from(callback: Callable | None = None) None#

Asynchronously disconnect from this access point.

Parameters:

callback (Callable | None, default: None) -- A function to call when the connection deactivation is complete. The function will receive self and a boolean value: True on success, False on failure.

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.

forget(callback: Callable | None = None) None#

Forget (delete) the stored connection. :rtype: None

Args:

callback: A function to call when the connection deletion is complete. The function will receive self and a boolean value: True on success, False on failure.

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

A VPN connection.

removed()#

Emitted when this VPN connection is removed.

property is_connected: bool#
  • read-only

Whether the device is connected to the network.

property name: str | None#
  • read-only

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

toggle_connection() None#

Toggle this VPN depending on it's is_connected property

Return type:

None

connect_to() None#

Connect to this VPN.

Return type:

None

disconnect_from() None#

Disconnect from this VPN.

Return type:

None