Class AppLaunchContext
- All Implemented Interfaces:
Proxy
Handles launching an application in a graphical context.
It is an implementation of GAppLaunchContext that provides startup
notification and allows to launch applications on a specific workspace.
Launching an application
GdkAppLaunchContext *context;
context = gdk_display_get_app_launch_context (display);
gdk_app_launch_context_set_timestamp (gdk_event_get_time (event));
if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
g_warning ("Launching failed: %s\\n", error->message);
g_object_unref (context);
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAppLaunchContext.Builder<B extends AppLaunchContext.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class AppLaunchContext
AppLaunchContext.AppLaunchContextClass, AppLaunchContext.LaunchedCallback, AppLaunchContext.LaunchFailedCallback, AppLaunchContext.LaunchStartedCallbackNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new AppLaunchContext.AppLaunchContext(MemorySegment address) Create a AppLaunchContext instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected AppLaunchContextasParent()Return this instance as if it were its parent type.static AppLaunchContext.Builder<? extends AppLaunchContext.Builder> builder()AAppLaunchContext.Builderobject constructs aAppLaunchContextwith the specified properties.Gets theGdkDisplaythat this AppLaunchContext is for.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the AppLaunchContext class.voidsetDesktop(int desktop) Sets the workspace on which applications will be launched.voidSets the icon for applications that are launched with this context.voidsetIconName(@Nullable String iconName) Sets the icon for applications that are launched with this context.voidsetTimestamp(int timestamp) Sets the timestamp ofcontext.Methods inherited from class AppLaunchContext
emitLaunched, emitLaunchFailed, emitLaunchStarted, getDisplay, getEnvironment, getStartupNotifyId, launched, launchFailed, launchStarted, onLaunched, onLaunchFailed, onLaunchStarted, setenv, unsetenvMethods inherited from class 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 TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
AppLaunchContext
Create a AppLaunchContext instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
AppLaunchContext
public AppLaunchContext()Create 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
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code.- Overrides:
asParentin classAppLaunchContext- Returns:
- the instance as if it were its parent type
-
getDisplay
Gets theGdkDisplaythat this AppLaunchContext is for.- Returns:
- the display of this AppLaunchContext
-
setDesktop
public void setDesktop(int desktop) Sets the workspace on which applications will be launched.
This only works when running under a window manager that supports multiple workspaces, as described in the Extended Window Manager Hints. Specifically this sets the
_NET_WM_DESKTOPproperty described in that spec.This only works when using the X11 backend.
When the workspace is not specified or
desktopis set to -1, it is up to the window manager to pick one, typically it will be the current workspace.- Parameters:
desktop- the number of a workspace, or -1
-
setIcon
Sets the icon for applications that are launched with this context.
Window Managers can use this information when displaying startup notification.
See also
setIconName(String).- Parameters:
icon- aGIcon
-
setIconName
Sets the icon for applications that are launched with this context.
The
iconNamewill be interpreted in the same way as the Icon field in desktop files. See alsosetIcon(Icon).If both
iconandiconNameare set, theiconNametakes priority. If neithericonoriconNameis set, the icon is taken from either the file that is passed to launched application or from theGAppInfofor the launched application itself.- Parameters:
iconName- an icon name
-
setTimestamp
public void setTimestamp(int timestamp) Sets the timestamp of
context.The timestamp should ideally be taken from the event that triggered the launch.
Window managers can use this information to avoid moving the focus to the newly launched application when the user is busy typing in another window. This is also known as 'focus stealing prevention'.
- Parameters:
timestamp- a timestamp
-
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
-