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
stdoutof 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
commandis astr, it will be evaluated withshell=Truei.e. in the default shell (for example, bash).Returns: The stdoutof 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
PATHor 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
kthreaddetc.) are excluded.Parameters: process (str) – The name of the process. Returns: Is the process running? Return type: bool