Gio.AppLaunchContext¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
|
The |
|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gio.AppLaunchContext(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Integrating the launch with the launching application. This is used to handle for instance startup notification and launching the new application on the same screen as the launching window.
- classmethod new()[source]¶
- Returns:
- Return type:
Creates a new application launch context. This is not normally used, instead you instantiate a subclass of this, such as #GdkAppLaunchContext.
- get_display(info, files)[source]¶
- Parameters:
info (
Gio.AppInfo
) – aGio.AppInfo
- Returns:
a display string for the display.
- Return type:
Gets the display string for the self. This is used to ensure new applications are started on the same display as the launching application, by setting the
DISPLAY
environment variable.
- get_environment()[source]¶
- Returns:
the child’s environment
- Return type:
[
str
]
Gets the complete environment variable list to be passed to the child process when self is used to launch an application. This is a
None
-terminated array of strings, where each string has the formKEY=VALUE
.New in version 2.32.
- get_startup_notify_id(info, files)[source]¶
- Parameters:
info (
Gio.AppInfo
) – aGio.AppInfo
- Returns:
a startup notification ID for the application, or
None
if not supported.- Return type:
Initiates startup notification for the application and returns the
XDG_ACTIVATION_TOKEN
orDESKTOP_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.
- launch_failed(startup_notify_id)[source]¶
- Parameters:
startup_notify_id (
str
) – the startup notification id that was returned byGio.AppLaunchContext.get_startup_notify_id
().
Called when an application has failed to launch, so that it can cancel the application startup notification started in
Gio.AppLaunchContext.get_startup_notify_id
().
- setenv(variable, value)[source]¶
- Parameters:
Arranges for variable to be set to value in the child’s environment when self is used to launch an application.
New in version 2.32.
- unsetenv(variable)[source]¶
- Parameters:
variable (
str
) – the environment variable to remove
Arranges for variable to be unset in the child’s environment when self is used to launch an application.
New in version 2.32.
- do_get_display(info, files) virtual¶
- Parameters:
info (
Gio.AppInfo
) – aGio.AppInfo
- Returns:
a display string for the display.
- Return type:
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.
- do_get_startup_notify_id(info, files) virtual¶
- Parameters:
info (
Gio.AppInfo
) – aGio.AppInfo
- Returns:
a startup notification ID for the application, or
None
if not supported.- Return type:
Initiates startup notification for the application and returns the
XDG_ACTIVATION_TOKEN
orDESKTOP_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.
- do_launch_failed(startup_notify_id) virtual¶
- Parameters:
startup_notify_id (
str
) – the startup notification id that was returned byGio.AppLaunchContext.get_startup_notify_id
().
Called when an application has failed to launch, so that it can cancel the application startup notification started in
Gio.AppLaunchContext.get_startup_notify_id
().
- do_launch_started(info, platform_data) virtual¶
- Parameters:
info (
Gio.AppInfo
) –platform_data (
GLib.Variant
) –
- do_launched(info, platform_data) virtual¶
- Parameters:
info (
Gio.AppInfo
) –platform_data (
GLib.Variant
) –
Signal Details¶
- Gio.AppLaunchContext.signals.launch_failed(app_launch_context, startup_notify_id)¶
- Signal Name:
launch-failed
- Flags:
- Parameters:
app_launch_context (
Gio.AppLaunchContext
) – The object which received the signalstartup_notify_id (
str
) – the startup notification id for the failed launch
The
Gio.AppLaunchContext
::launch-failed
signal is emitted when aGio.AppInfo
launch fails. The startup notification id is provided, so that the launcher can cancel the startup notification.Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one for each spawned instance.
New in version 2.36.
- Gio.AppLaunchContext.signals.launch_started(app_launch_context, info, platform_data)¶
- Signal Name:
launch-started
- Flags:
- Parameters:
app_launch_context (
Gio.AppLaunchContext
) – The object which received the signalinfo (
Gio.AppInfo
) – theGio.AppInfo
that is about to be launchedplatform_data (
GLib.Variant
orNone
) – additional platform-specific data for this launch
The
Gio.AppLaunchContext
::launch-started
signal is emitted when aGio.AppInfo
is about to be launched. If non-null the platform_data is anGLib.Variant
dictionary mapping strings to variants (iea{sv}
), which contains additional, platform-specific data about this launch. On UNIX, at least thestartup-notification-id
keys will be present.The value of the
startup-notification-id
key (types
) is a startup notification ID corresponding to the format from the startup-notification specification. It allows tracking the progress of the launchee through startup.It is guaranteed that this signal is followed by either a
Gio.AppLaunchContext
::launched
orGio.AppLaunchContext
::launch-failed
signal.Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one for each spawned instance.
New in version 2.72.
- Gio.AppLaunchContext.signals.launched(app_launch_context, info, platform_data)¶
- Signal Name:
launched
- Flags:
- Parameters:
app_launch_context (
Gio.AppLaunchContext
) – The object which received the signalinfo (
Gio.AppInfo
) – theGio.AppInfo
that was just launchedplatform_data (
GLib.Variant
) – additional platform-specific data for this launch
The
Gio.AppLaunchContext
::launched
signal is emitted when aGio.AppInfo
is successfully launched.Because a launch operation may involve spawning multiple instances of the target application, you should expect this signal to be emitted multiple times, one time for each spawned instance.
The platform_data is an
GLib.Variant
dictionary mapping strings to variants (iea{sv}
), which contains additional, platform-specific data about this launch. On UNIX, at least thepid
andstartup-notification-id
keys will be present.Since 2.72 the
pid
may be 0 if the process id wasn’t known (for example if the process was launched via D-Bus). Thepid
may not be set at all in subsequent releases.On Windows,
pid
is guaranteed to be valid only for the duration of theGio.AppLaunchContext
::launched
signal emission; after the signal is emitted, GLib will callGLib.spawn_close_pid
(). If you need to keep the #GPid after the signal has been emitted, then you can duplicatepid
usingDuplicateHandle()
.New in version 2.36.