class Gdk::AppLaunchContext


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

WARNING ⚠️ The following code is in c ⚠️

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 ("", context, &error))
  g_warning ("Launching failed: %s\n", error->message);

g_object_unref (context);

Defined in:



Class Method Summary

Instance Method Summary

Instance methods inherited from class Gio::AppLaunchContext

display(info : Gio::AppInfo, files : GLib::List) : String? display, environment : Enumerable(String) environment, launch_failed(startup_notify_id : String) : Nil launch_failed, launch_failed_signal launch_failed_signal, launch_started_signal launch_started_signal, launched_signal launched_signal, setenv(variable : String, value : String) : Nil setenv, startup_notify_id(info : Gio::AppInfo, files : GLib::List) : String? startup_notify_id, unsetenv(variable : String) : Nil unsetenv

Constructor methods inherited from class Gio::AppLaunchContext

new : self new

Class methods inherited from class Gio::AppLaunchContext

g_type : UInt64 g_type

Instance methods inherited from class GObject::Object

bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void)? data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void)? qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void)?) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void)? steal_data, steal_qdata(quark : UInt32) : Pointer(Void)? steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, cast?(obj : GObject::Object) : self? cast?, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

compat_control(what : UInt64, data : Pointer(Void)?) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Constructor Detail

def #

Initialize a new AppLaunchContext.

def*, display : Gdk::Display? = nil) #

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.

Instance Method Detail

def desktop=(desktop : Int32) : Nil #

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.

def display : Gdk::Display #

Gets the GdkDisplay that @context is for.

def display=(value : Gdk::Display?) : Gdk::Display? #

def icon=(icon : Gio::Icon?) : Nil #

Sets the icon for applications that are launched with this context.

Window Managers can use this information when displaying startup notification.

See also Gdk::AppLaunchContext#icon_name=.

def icon_name=(icon_name : String?) : Nil #

Sets the icon for applications that are launched with this context.

The @icon_name will be interpreted in the same way as the Icon field in desktop files. See also Gdk::AppLaunchContext#icon=.

If both @icon and @icon_name are set, the @icon_name takes priority. If neither @icon or @icon_name is set, the icon is taken from either the file that is passed to launched application or from the GAppInfo for the launched application itself.

def timestamp=(timestamp : UInt32) : Nil #

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'.