libdesktop.system

A module for general interaction with the system, like processes or executables.

libdesktop.system.get_cmd_out(command)[source]

Get the output of a command.

Gets a nice Unicode no-extra-whitespace string of the stdout of a given command.

Parameters:command (str or list) – A string of the command, or a list of the arguments (as would be used in subprocess.Popen).

Note

If command is a str, it will be evaluated with shell=True i.e. in the default shell (for example, bash).

Returns:The stdout of the command.
Return type:str
libdesktop.system.get_name()[source]

Get desktop environment or OS.

Get the OS name or desktop environment.

List of Possible Values

Returns:The name of the desktop environment or OS.
Return type:str
libdesktop.system.is_in_path(program)[source]

Check if a program is in the system PATH.

Checks if a given program is in the user’s PATH or not.

Parameters:program (str) – The program to try to find in PATH.
Returns:Is the program in PATH?
Return type:bool
libdesktop.system.is_running(process)[source]

Check if process is running.

Check if the given process name is running or not.

Note

On a Linux system, kernel threads (like kthreadd etc.) are excluded.

Parameters:process (str) – The name of the process.
Returns:Is the process running?
Return type:bool