system

System utilities.

deltona.system.CHROME_DEFAULT_CONFIG_PATH

Default Chrome config path.

deltona.system.CHROME_DEFAULT_LOCAL_STATE_PATH

Default Chrome local state path.

deltona.system.IS_LINUX

If the system is Linux.

exception deltona.system.MultipleKeySlots(dev: str)

Bases: Exception

Raised when a LUKS device has more than one keyslot.

deltona.system.find_bluetooth_device_info_by_name(name: str) tuple[str, dict[str, Any]]

Get Bluetooth device information from D-Bus (bluez) by name.

Note that not all devices present a name.

Parameters:
name : str

Name of the device. Case sensitive.

Returns:

Returns the D-Bus object path and a dictionary representing the org.bluez.Device1 properties.

Return type:

tuple[str, dict[str, Any]]

Raises:
deltona.system.get_kwriteconfig_commands(file: StrPath = PosixPath('/home/docs/.config/kdeglobals')) Iterator[str]

Generate kwriteconfig6 commands from a KDE configuration file.

Parameters:
file : StrPath

Path to the KDE configuration file.

Yields:

str – A kwriteconfig6 command string.

deltona.system.inhibit_notifications(name: str = 'deltona.system', reason: str = 'No reason specified.') bool

Disable notifications.

This function is meant to be called from a separate thread from the working task thread during initialisation.

Parameters:
name : str

Name of application.

reason : str

Reason for inhibition.

Returns:

True if inhibited, False otherwise.

Return type:

bool

deltona.system.kill_gamescope() None

Kill all running Gamescope and gamescopereaper processes.

deltona.system.kill_wine() None

Kill all running Wine processes including wineserver and Wine-wrapped executables.

deltona.system.pan_connect(device_mac: str, hci: str = 'hci0') None

Connect to a Bluetooth PAN (Personal Area Network) device.

Parameters:
device_mac : str

MAC address of the Bluetooth device.

hci : str

HCI adapter name.

Raises:

NotImplementedError – If not on Linux.

deltona.system.pan_disconnect(device_mac: str, hci: str = 'hci0') None

Disconnect from a Bluetooth PAN (Personal Area Network) device.

Parameters:
device_mac : str

MAC address of the Bluetooth device.

hci : str

HCI adapter name.

Raises:

NotImplementedError – If not on Linux.

deltona.system.patch_macos_bundle_info_plist(bundle: str | PathLike[str], **data: Any) None

Patch a macOS application bundle’s Info.plist with additional data.

Parameters:
bundle : StrPath

Path to the .app bundle.

**data : Any

Key-value pairs to merge into the plist.

deltona.system.reset_tpm_enrollment(uuid: str, *, dry_run: bool = True) None

Reset TPM2 enrolment for a LUKS-encrypted device.

Parameters:
uuid : str

UUID of the LUKS device.

dry_run : bool

If True, only log the commands that would be run.

Raises:

MultipleKeySlots – If the device has more than one keyslot associated with the TPM2 token.

deltona.system.slug_rename(path: str | PathLike[str], *, no_lower: bool = False) str | PathLike[str]

Perform a slug rename on a file or directory.

Parameters:
path : StrPath

Path to the file or directory.

no_lower : bool

If True, do not convert to lowercase.

Returns:

The new path after renaming.

Return type:

StrPath

deltona.system.uninhibit_notifications() None

Enable notifications.

This function is meant to be called from a separate thread from the working task thread during clean-up.

This function is not required to be called if the application will exit as the state will be restored on clean-up of the D-Bus connection.

Raises:

ConnectionError – If D-Bus connection is not available (which can be caused by not having pydbus installed).

deltona.system.wait_for_disc(drive_path: Annotated[str | PathLike[str], 'must_exist'] = 'dev/sr0', *, sleep_time: float = 1.0) bool

Wait for a disc to be ready in a drive.

For Linux only.

Parameters:
drive_path : StrPathMustExist

Path to the optical drive device.

sleep_time : float

Seconds to sleep between polling attempts.

Returns:

True if the disc is ready, False if interrupted.

Return type:

bool