Class AppLaunchContext
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
AppLaunchContext
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classAppLaunchContext.Builder<B extends AppLaunchContext.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theLaunchedCallbackcallback.static interfaceFunctional interface declaration of theLaunchFailedCallbackcallback.static interfaceFunctional interface declaration of theLaunchStartedCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new AppLaunchContext.AppLaunchContext(MemorySegment address) Create a AppLaunchContext proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected AppLaunchContextasParent()Returns this instance as if it were its parent type.static AppLaunchContext.Builder<? extends AppLaunchContext.Builder> builder()AAppLaunchContext.Builderobject constructs aAppLaunchContextwith the specified properties.voidemitLaunched(@Nullable AppInfo info, @Nullable Variant platformData) Emits the "launched" signal.voidemitLaunchFailed(String startupNotifyId) Emits the "launch-failed" signal.voidemitLaunchStarted(@Nullable AppInfo info, @Nullable Variant platformData) Emits the "launch-started" signal.@Nullable StringgetDisplay(AppInfo info, List<File> files) Gets the display string for thecontext.This is used to ensure new applications are started on the same display as the launching application, by setting theDISPLAYenvironment variable.String[]Gets the complete environment variable list to be passed to the child process when this AppLaunchContext is used to launch an application.static MemoryLayoutThe memory layout of the native struct.@Nullable StringgetStartupNotifyId(@Nullable AppInfo info, @Nullable List<File> files) Initiates startup notification for the application and returns theXDG_ACTIVATION_TOKENorDESKTOP_STARTUP_IDfor the launched operation, if supported.static @Nullable TypegetType()Get the GType of the AppLaunchContext classprotected voidvoidlaunchFailed(String startupNotifyId) Called when an application has failed to launch, so that it can cancel the application startup notification started ingetStartupNotifyId(org.gnome.gio.AppInfo, org.gnome.glib.List<org.gnome.gio.File>).protected voidlaunchStarted(AppInfo info, Variant platformData) TheGio.AppLaunchContext::launchedsignal is emitted when aAppInfois successfully launched.TheGio.AppLaunchContext::launch-failedsignal is emitted when aAppInfolaunch fails.TheGio.AppLaunchContext::launch-startedsignal is emitted when aAppInfois about to be launched.voidArranges forvariableto be set tovaluein the child’s environment when this AppLaunchContext is used to launch an application.voidArranges forvariableto be unset in the child’s environment when this AppLaunchContext is used to launch an application.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
AppLaunchContext
Create a AppLaunchContext proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
AppLaunchContext
public AppLaunchContext()Creates a new AppLaunchContext.
-
-
Method Details
-
getType
Get the GType of the AppLaunchContext class- Returns:
- the GType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getDisplay
Gets the display string for thecontext.This is used to ensure new applications are started on the same display as the launching application, by setting theDISPLAYenvironment variable.- Parameters:
info- the app infofiles- a list ofFileobjects- Returns:
- a display string for the display.
-
getEnvironment
Gets the complete environment variable list to be passed to the child process when this AppLaunchContext is used to launch an application. This is aNULL-terminated array of strings, where each string has the formKEY=VALUE.- Returns:
- the child’s environment
- Since:
- 2.32
-
getStartupNotifyId
Initiates startup notification for the application and returns theXDG_ACTIVATION_TOKENorDESKTOP_STARTUP_IDfor 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
infoandfilescan beNULL. If that’s not supported by the backend, the returned token will beNULL.- Parameters:
info- the app infofiles- a list ofFileobjects- Returns:
- a startup notification ID for the application, or
NULLif not supported.
-
launchFailed
Called when an application has failed to launch, so that it can cancel the application startup notification started ingetStartupNotifyId(org.gnome.gio.AppInfo, org.gnome.glib.List<org.gnome.gio.File>).- Parameters:
startupNotifyId- the startup notification id that was returned bygetStartupNotifyId(org.gnome.gio.AppInfo, org.gnome.glib.List<org.gnome.gio.File>).
-
setenv
-
unsetenv
Arranges forvariableto be unset in the child’s environment when this AppLaunchContext is used to launch an application.- Parameters:
variable- the environment variable to remove- Since:
- 2.32
-
launchStarted
-
launched
-
onLaunchFailed
public SignalConnection<AppLaunchContext.LaunchFailedCallback> onLaunchFailed(AppLaunchContext.LaunchFailedCallback handler) TheGio.AppLaunchContext::launch-failedsignal is emitted when aAppInfolaunch 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.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.36
- See Also:
-
emitLaunchFailed
Emits the "launch-failed" signal. SeeonLaunchFailed(org.gnome.gio.AppLaunchContext.LaunchFailedCallback). -
onLaunchStarted
public SignalConnection<AppLaunchContext.LaunchStartedCallback> onLaunchStarted(AppLaunchContext.LaunchStartedCallback handler) TheGio.AppLaunchContext::launch-startedsignal is emitted when aAppInfois about to be launched. If non-null theplatformDatais an GVariant dictionary mapping strings to variants (iea{sv}), which contains additional, platform-specific data about this launch. On UNIX, at least thestartup-notification-idkeys will be present.The value of the
startup-notification-idkey (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::launchedorGio.AppLaunchContext::launch-failedsignal.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.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.72
- See Also:
-
emitLaunchStarted
Emits the "launch-started" signal. SeeonLaunchStarted(org.gnome.gio.AppLaunchContext.LaunchStartedCallback). -
onLaunched
public SignalConnection<AppLaunchContext.LaunchedCallback> onLaunched(AppLaunchContext.LaunchedCallback handler) TheGio.AppLaunchContext::launchedsignal is emitted when aAppInfois 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
platformDatais an GVariant dictionary mapping strings to variants (iea{sv}), which contains additional, platform-specific data about this launch. On UNIX, at least thepidandstartup-notification-idkeys will be present.Since 2.72 the
pidmay be 0 if the process id wasn’t known (for example if the process was launched via D-Bus). Thepidmay not be set at all in subsequent releases.On Windows,
pidis guaranteed to be valid only for the duration of theGio.AppLaunchContext::launchedsignal emission; after the signal is emitted, GLib will callGLib.spawnClosePid(org.gnome.glib.Pid). If you need to keep theGLib.Pidafter the signal has been emitted, then you can duplicatepidusingDuplicateHandle().- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- Since:
- 2.36
- See Also:
-
emitLaunched
Emits the "launched" signal. SeeonLaunched(org.gnome.gio.AppLaunchContext.LaunchedCallback). -
builder
AAppLaunchContext.Builderobject constructs aAppLaunchContextwith the specified properties. Use the variousset...()methods to set properties, and finish construction withAppLaunchContext.Builder.build().- Returns:
- the builder object
-