ShellApp

ShellApp — Object representing an application

Synopsis

struct              ShellAppClass;
enum                ShellAppState;
const char *        shell_app_get_id                    (ShellApp *app);
GDesktopAppInfo *   shell_app_get_app_info              (ShellApp *app);
ClutterActor *      shell_app_create_icon_texture       (ShellApp *app,
                                                         int size);
ClutterActor *      shell_app_get_faded_icon            (ShellApp *app,
                                                         int size,
                                                         ClutterTextDirection direction);
const char *        shell_app_get_name                  (ShellApp *app);
const char *        shell_app_get_description           (ShellApp *app);
gboolean            shell_app_is_window_backed          (ShellApp *app);
void                shell_app_activate_window           (ShellApp *app,
                                                         MetaWindow *window,
                                                         guint32 timestamp);
void                shell_app_activate                  (ShellApp *app);
void                shell_app_activate_full             (ShellApp *app,
                                                         int workspace,
                                                         guint32 timestamp);
void                shell_app_open_new_window           (ShellApp *app,
                                                         int workspace);
ShellAppState       shell_app_get_state                 (ShellApp *app);
gboolean            shell_app_request_quit              (ShellApp *app);
guint               shell_app_get_n_windows             (ShellApp *app);
GSList *            shell_app_get_windows               (ShellApp *app);
GSList *            shell_app_get_pids                  (ShellApp *app);
gboolean            shell_app_is_on_workspace           (ShellApp *app,
                                                         MetaWorkspace *workspace);
gboolean            shell_app_launch                    (ShellApp *app,
                                                         guint timestamp,
                                                         int workspace,
                                                         GError **error);
void                shell_app_launch_action             (ShellApp *app,
                                                         const char *action_name,
                                                         guint timestamp,
                                                         int workspace);
int                 shell_app_compare_by_name           (ShellApp *app,
                                                         ShellApp *other);
int                 shell_app_compare                   (ShellApp *app,
                                                         ShellApp *other);
void                shell_app_update_window_actions     (ShellApp *app,
                                                         MetaWindow *window);
void                shell_app_update_app_menu           (ShellApp *app,
                                                         MetaWindow *window);
                    ShellAppAction;
                    ShellApp;

Object Hierarchy

  GEnum
   +----ShellAppState
  GObject
   +----ShellApp

Properties

  "action-group"             GActionGroup*         : Read
  "id"                       gchar*                : Read
  "menu"                     GMenuModel*           : Read
  "state"                    ShellAppState         : Read

Signals

  "windows-changed"                                : Run Last

Description

This object wraps a GDesktopAppInfo, providing methods and signals primarily useful for running applications.

Details

struct ShellAppClass

struct ShellAppClass {
  GObjectClass parent_class;
};

enum ShellAppState

typedef enum {
  SHELL_APP_STATE_STOPPED,
  SHELL_APP_STATE_STARTING,
  SHELL_APP_STATE_RUNNING,
  SHELL_APP_STATE_BUSY
} ShellAppState;

SHELL_APP_STATE_STOPPED

SHELL_APP_STATE_STARTING

SHELL_APP_STATE_RUNNING

SHELL_APP_STATE_BUSY


shell_app_get_id ()

const char *        shell_app_get_id                    (ShellApp *app);

shell_app_get_app_info ()

GDesktopAppInfo *   shell_app_get_app_info              (ShellApp *app);

app :

a ShellApp

Returns :

The GDesktopAppInfo for this app, or NULL if backed by a window. [transfer none]

shell_app_create_icon_texture ()

ClutterActor *      shell_app_create_icon_texture       (ShellApp *app,
                                                         int size);

Look up the icon for this application, and create a ClutterTexture for it at the given size.

Returns :

A floating ClutterActor. [transfer none]

shell_app_get_faded_icon ()

ClutterActor *      shell_app_get_faded_icon            (ShellApp *app,
                                                         int size,
                                                         ClutterTextDirection direction);

Return an actor with a horizontally faded look.

app :

A ShellApp

size :

Size in pixels

direction :

Whether to fade on the left or right

Returns :

A floating ClutterActor, or NULL if no icon. [transfer none]

shell_app_get_name ()

const char *        shell_app_get_name                  (ShellApp *app);

shell_app_get_description ()

const char *        shell_app_get_description           (ShellApp *app);

shell_app_is_window_backed ()

gboolean            shell_app_is_window_backed          (ShellApp *app);

A window backed application is one which represents just an open window, i.e. there's no .desktop file assocation, so we don't know how to launch it again.


shell_app_activate_window ()

void                shell_app_activate_window           (ShellApp *app,
                                                         MetaWindow *window,
                                                         guint32 timestamp);

Bring all windows for the given app to the foreground, but ensure that window is on top. If window is NULL, the window with the most recent user time for the app will be used.

This function has no effect if app is not currently running.

app :

a ShellApp

window :

Window to be focused. [allow-none]

timestamp :

Event timestamp

shell_app_activate ()

void                shell_app_activate                  (ShellApp *app);

Like shell_app_activate_full(), but using the default workspace and event timestamp.

app :

a ShellApp

shell_app_activate_full ()

void                shell_app_activate_full             (ShellApp *app,
                                                         int workspace,
                                                         guint32 timestamp);

Perform an appropriate default action for operating on this application, dependent on its current state. For example, if the application is not currently running, launch it. If it is running, activate the most recently used NORMAL window (or if that window has a transient, the most recently used transient for that window).

app :

a ShellApp

workspace :

launch on this workspace, or -1 for default. Ignored if activating an existing window

timestamp :

Event timestamp

shell_app_open_new_window ()

void                shell_app_open_new_window           (ShellApp *app,
                                                         int workspace);

Request that the application create a new window.

app :

a ShellApp

workspace :

open on this workspace, or -1 for default

shell_app_get_state ()

ShellAppState       shell_app_get_state                 (ShellApp *app);

app :

a ShellApp

Returns :

State of the application

shell_app_request_quit ()

gboolean            shell_app_request_quit              (ShellApp *app);

Initiate an asynchronous request to quit this application. The application may interact with the user, and the user might cancel the quit request from the application UI.

This operation may not be supported for all applications.

app :

A ShellApp

Returns :

TRUE if a quit request is supported for this application

shell_app_get_n_windows ()

guint               shell_app_get_n_windows             (ShellApp *app);

shell_app_get_windows ()

GSList *            shell_app_get_windows               (ShellApp *app);

Get the windows which are associated with this application. The returned list will be sorted first by whether they're on the active workspace, then by whether they're visible, and finally by the time the user last interacted with them.

Returns :

List of windows. [transfer none][element-type MetaWindow]

shell_app_get_pids ()

GSList *            shell_app_get_pids                  (ShellApp *app);

app :

a ShellApp

Returns :

An unordered list of process identifers associated with this application. [transfer container][element-type int]

shell_app_is_on_workspace ()

gboolean            shell_app_is_on_workspace           (ShellApp *app,
                                                         MetaWorkspace *workspace);

shell_app_launch ()

gboolean            shell_app_launch                    (ShellApp *app,
                                                         guint timestamp,
                                                         int workspace,
                                                         GError **error);

timestamp :

Event timestamp, or 0 for current event timestamp

workspace :

Start on this workspace, or -1 for default

error :

A GError

shell_app_launch_action ()

void                shell_app_launch_action             (ShellApp *app,
                                                         const char *action_name,
                                                         guint timestamp,
                                                         int workspace);

app :

the ShellApp

action_name :

the name of the action to launch (as obtained by g_desktop_app_info_list_actions())

timestamp :

Event timestamp, or 0 for current event timestamp

workspace :

Start on this workspace, or -1 for default

shell_app_compare_by_name ()

int                 shell_app_compare_by_name           (ShellApp *app,
                                                         ShellApp *other);

Order two applications by name.

app :

One app

other :

The other app

Returns :

-1, 0, or 1; suitable for use as a comparison function for e.g. g_slist_sort()

shell_app_compare ()

int                 shell_app_compare                   (ShellApp *app,
                                                         ShellApp *other);

Compare one ShellApp instance to another, in the following way: - Running applications sort before not-running applications. - The application which the user interacted with most recently compares earlier.

other :

A ShellApp

shell_app_update_window_actions ()

void                shell_app_update_window_actions     (ShellApp *app,
                                                         MetaWindow *window);

shell_app_update_app_menu ()

void                shell_app_update_app_menu           (ShellApp *app,
                                                         MetaWindow *window);

ShellAppAction

typedef struct _ShellAppAction ShellAppAction;

ShellApp

typedef struct _ShellApp ShellApp;

Property Details

The "action-group" property

  "action-group"             GActionGroup*         : Read

The GDBusActionGroup associated with this ShellApp, if any. See the documentation of GApplication and GActionGroup for details.


The "id" property

  "id"                       gchar*                : Read

The id of this application (a desktop filename, or a special string like window:0xabcd1234)

Default value: NULL


The "menu" property

  "menu"                     GMenuModel*           : Read

The GMenuProxy associated with this ShellApp, if any. See the documentation of GMenuModel for details.


The "state" property

  "state"                    ShellAppState         : Read

The high-level state of the application, effectively whether it's running or not, or transitioning between those states.

Default value: SHELL_APP_STATE_STOPPED

Signal Details

The "windows-changed" signal

void                user_function                      (ShellApp *shellapp,
                                                        gpointer  user_data)      : Run Last