Class AppLaunchContext
- All Implemented Interfaces:
Proxy
GdkAppLaunchContext
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
Modifier and TypeClassDescriptionstatic class
AppLaunchContext.Builder<B extends AppLaunchContext.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.Nested classes/interfaces inherited from class org.gnome.gio.AppLaunchContext
AppLaunchContext.AppLaunchContextClass, AppLaunchContext.LaunchedCallback, AppLaunchContext.LaunchFailedCallback, AppLaunchContext.LaunchStartedCallback
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionAppLaunchContext
(MemorySegment address) Create a AppLaunchContext proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected AppLaunchContext
asParent()
Returns this instance as if it were its parent type.static AppLaunchContext.Builder
<? extends AppLaunchContext.Builder> builder()
AAppLaunchContext.Builder
object constructs aAppLaunchContext
with the specified properties.Gets theGdkDisplay
that this AppLaunchContext is for.static Type
getType()
Get the GType of the AppLaunchContext classvoid
setDesktop
(int desktop) Sets the workspace on which applications will be launched.void
Sets the icon for applications that are launched with this context.void
setIconName
(@Nullable String iconName) Sets the icon for applications that are launched with this context.void
setTimestamp
(int timestamp) Sets the timestamp of this AppLaunchContext.Methods inherited from class org.gnome.gio.AppLaunchContext
emitLaunched, emitLaunchFailed, emitLaunchStarted, getDisplay, getEnvironment, getMemoryLayout, getStartupNotifyId, launched, launchFailed, launchStarted, onLaunched, onLaunchFailed, onLaunchStarted, setenv, unsetenv
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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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.- Overrides:
asParent
in classAppLaunchContext
-
getDisplay
Gets theGdkDisplay
that 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_DESKTOP
property described in that spec.This only works when using the X11 backend.
When the workspace is not specified or
desktop
is 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(java.lang.String)
.- Parameters:
icon
- aGIcon
-
setIconName
Sets the icon for applications that are launched with this context.The
iconName
will be interpreted in the same way as the Icon field in desktop files. See alsosetIcon(org.gnome.gio.Icon)
.If both
icon
andiconName
are set, theiconName
takes priority. If neithericon
oriconName
is set, the icon is taken from either the file that is passed to launched application or from theGAppInfo
for the launched application itself.- Parameters:
iconName
- an icon name
-
setTimestamp
public void setTimestamp(int timestamp) Sets the timestamp of this AppLaunchContext.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.Builder
object constructs aAppLaunchContext
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withAppLaunchContext.Builder.build()
.
-