Class: Gio::AppLaunchContext

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Gio::AppLaunchContext

Creates a new application launch context. This is not normally used,
instead you instantiate a subclass of this, such as
GdkAppLaunchContext.

Instance Method Details

#environment ⇒ Array<Gio::filename>

Gets the complete environment variable list to be passed to
the child process when context is used to launch an application.
This is a NULL-terminated array of strings, where each string has
the form KEY=VALUE.

Returns:

  • (Array<Gio::filename>) —

    the child’s environment

#get_display(info, files) ⇒ String

Gets the display string for the context. This is used to ensure new
applications are started on the same display as the launching
application, by setting the DISPLAY environment variable.

Parameters:

  • info (Gio::AppInfo) —

    the app info

  • files (GLib::List<Gio::File>) —

    a list of [ifaceGio.File] objects

Returns:

  • (String) —

    a display string for the display.

#get_startup_notify_id(info, files) ⇒ String

Initiates startup notification for the application and returns the
XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID for the launched operation,
if supported.

The returned token may be referred to equivalently as an ‘activation token’
(using Wayland terminology) or a ‘startup sequence ID’ (using X11 terminology).
The two are interoperable.

Activation tokens are defined in the XDG Activation Protocol,
and startup notification IDs are defined in the
freedesktop.org Startup Notification Protocol.

Support for the XDG Activation Protocol was added in GLib 2.76.
Since GLib 2.82 info and files can be NULL. If that’s not supported by the backend,
the returned token will be NULL.

Parameters:

  • info (Gio::AppInfo) —

    the app info

  • files (GLib::List<Gio::File>) —

    a list of [ifaceGio.File] objects

Returns:

  • (String) —

    a startup notification ID for the application, or NULL if
    not supported.

#launch_failed(startup_notify_id) ⇒ nil

Called when an application has failed to launch, so that it can cancel
the application startup notification started in
[methodGio.AppLaunchContext.get_startup_notify_id].

Parameters:

  • startup_notify_id (String) —

    the startup notification id that was returned by
    [methodGio.AppLaunchContext.get_startup_notify_id].

Returns:

  • (nil)

#setenv(variable, value) ⇒ nil

Arranges for variable to be set to value in the child’s environment when
context is used to launch an application.

Parameters:

  • variable (Gio::filename) —

    the environment variable to set

  • value (Gio::filename) —

    the value for to set the variable to.

Returns:

  • (nil)

#unsetenv(variable) ⇒ nil

Arranges for variable to be unset in the child’s environment when context
is used to launch an application.

Parameters:

  • variable (Gio::filename) —

    the environment variable to remove

Returns:

  • (nil)