# Miscellaneous

This page collects the smaller globals that the script sandbox exports.

## ProcUtils

`ProcUtils` binds the process utilities C API. It is used by the access control scripts to find out what a client process actually is, since a PipeWire client's own properties cannot be trusted for security decisions.

ProcUtils.get_proc_info(pid)

  Binds `wp_proc_utils_get_proc_info()`

  Parameters:

    pid (integer) -- the process id to look up

  Returns:

    information about the process, or nil if it could not be read

  Return type:

    ProcInfo

ProcInfo.get_pid(self)
  Returns:

    the process id

  Return type:

    integer

ProcInfo.get_parent_pid(self)
  Returns:

    the process id of the parent process

  Return type:

    integer

ProcInfo.get_cgroup(self)
  Returns:

    the cgroup of the process, which is how sandboxed applications are identified

  Return type:

    string

ProcInfo.get_n_args(self)
  Returns:

    the number of command line arguments of the process

  Return type:

    integer

ProcInfo.get_arg(self, index)
  Parameters:

    index (integer) -- the index of the argument to return

  Returns:

    the command line argument at index

  Return type:

    string

## GLib

A handful of GLib functions that scripts occasionally need.

GLib.get_monotonic_time()
  Returns:

    the monotonic time in microseconds

  Return type:

    integer

GLib.get_real_time()
  Returns:

    the wall clock time in microseconds since the Unix epoch

  Return type:

    integer

GLib.access(filename, mode)

  Checks whether the given file is accessible in the given mode.

  Parameters:

    - filename (string) -- the path to check

    - mode (string) -- a combination of the letters `r`, `w`, `x` and `f`, as in the access(2) system call

  Returns:

    true if the file is accessible in that mode

  Return type:

    boolean

## I18n

Translation functions, for scripts that produce user-visible strings.

I18n.gettext(msgid)
  Parameters:

    msgid (string) -- the string to translate

  Returns:

    the translated string

  Return type:

    string

I18n.ngettext(msgid, msgid_plural, n)

  Translates a string, choosing the singular or plural form according to n.

  Parameters:

    - msgid (string) -- the singular form

    - msgid_plural (string) -- the plural form

    - n (integer) -- the number that decides which form is used

  Returns:

    the translated string

  Return type:

    string

## Plugin

Plugin.find(name)

  Binds `wp_plugin_find()`

  Looks up a loaded plugin by name. This is how scripts reach the API plugins, such as standard-event-source, mixer-api or default-nodes-api, whose functionality is exposed through GObject action signals; see `GObject.call()`.

      source = Plugin.find ("standard-event-source")

  Parameters:

    name (string) -- the name of the plugin, without any `libwireplumber-module-` prefix

  Returns:

    the plugin, or nil if it is not loaded

  Return type:

    Plugin

## Constants

Id

  `Id.INVALID` and `Id.ANY` both hold the value `0xffffffff`, used where an object id is expected but none is meant.

Perm

  PipeWire client permission flags; see Permissions API.

Feature, Features

  Object feature constants; see WpObject.