CinnamonApp: Cinnamon Reference Manual

## CinnamonApp CinnamonApp — Object representing an application |

## Functions

const char * | cinnamon_app_get_id ()
GMenuTreeEntry * | cinnamon_app_get_tree_entry ()
GMenuDesktopAppInfo * | cinnamon_app_get_app_info ()
ClutterActor * | cinnamon_app_create_icon_texture ()
ClutterActor * | cinnamon_app_create_icon_texture_for_window ()
const char * | cinnamon_app_get_name ()
const char * | cinnamon_app_get_description ()
const char * | cinnamon_app_get_keywords ()
gboolean | cinnamon_app_get_nodisplay ()
gboolean | cinnamon_app_is_window_backed ()
void | cinnamon_app_activate_window ()
void | cinnamon_app_activate ()
void | cinnamon_app_activate_full ()
void | cinnamon_app_open_new_window ()
gboolean | cinnamon_app_can_open_new_window ()
CinnamonAppState | cinnamon_app_get_state ()
gboolean | cinnamon_app_request_quit ()
guint | cinnamon_app_get_n_windows ()
GSList * | cinnamon_app_get_windows ()
GSList * | cinnamon_app_get_pids ()
gboolean | cinnamon_app_is_on_workspace ()
gboolean | cinnamon_app_launch ()
gboolean | cinnamon_app_launch_offloaded ()
gboolean | cinnamon_app_get_is_flatpak ()
char * | cinnamon_app_get_flatpak_app_id ()

## Properties

CinnamonAppState | state | Read

## Signals

void | windows-changed | Run Last

## Types and Values

enum | CinnamonAppState

## Object Hierarchy

        GEnum
        ╰── CinnamonAppState
        GObject
        ╰── CinnamonApp

## Description

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

## Functions

### cinnamon_app_get_id ()

    const char *
    cinnamon_app_get_id (CinnamonApp *app);

### cinnamon_app_get_tree_entry ()

    GMenuTreeEntry *
    cinnamon_app_get_tree_entry (CinnamonApp *app);

#### Parameters

app | a CinnamonApp |

#### Returns

The GMenuTreeEntry for this app, or `NULL` if backed by a window.

[transfer none]

### cinnamon_app_get_app_info ()

    GMenuDesktopAppInfo *
    cinnamon_app_get_app_info (CinnamonApp *app);

#### Parameters

app | a CinnamonApp |

#### Returns

The GMenuDesktopAppInfo for this app, or `NULL` if backed by a window.

[transfer none]

### cinnamon_app_create_icon_texture ()

    ClutterActor *
    cinnamon_app_create_icon_texture (CinnamonApp *app,
                                      int size);

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

#### Returns

A floating ClutterActor.

[transfer none]

### cinnamon_app_create_icon_texture_for_window ()

    ClutterActor *
    cinnamon_app_create_icon_texture_for_window
                                   (CinnamonApp *app,
                                    int size,
                                    MetaWindow *for_window);

Look up the icon for this application, and create a ClutterTexture for it at the given size. If for_window is NULL, it bases the icon off the most-recently-used window for the app, otherwise it attempts to use for_window for determining the icon.

#### Parameters

app | a CinnamonApp |
size | the size of the icon to create |
for_window | Optional - the backing MetaWindow to look up for. | [nullable]

#### Returns

A floating ClutterActor.

[transfer none]

### cinnamon_app_get_name ()

    const char *
    cinnamon_app_get_name (CinnamonApp *app);

### cinnamon_app_get_description ()

    const char *
    cinnamon_app_get_description (CinnamonApp *app);

### cinnamon_app_get_keywords ()

    const char *
    cinnamon_app_get_keywords (CinnamonApp *app);

### cinnamon_app_get_nodisplay ()

    gboolean
    cinnamon_app_get_nodisplay (CinnamonApp *app);

### cinnamon_app_is_window_backed ()

    gboolean
    cinnamon_app_is_window_backed (CinnamonApp *app);

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

### cinnamon_app_activate_window ()

    void
    cinnamon_app_activate_window (CinnamonApp *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.

#### Parameters

app | a CinnamonApp |
window | Window to be focused. | [nullable]
timestamp | Event timestamp |

### cinnamon_app_activate ()

    void
    cinnamon_app_activate (CinnamonApp *app);

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

#### Parameters

app | a CinnamonApp |

### cinnamon_app_activate_full ()

    void
    cinnamon_app_activate_full (CinnamonApp *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).

#### Parameters

app | a CinnamonApp |
workspace | launch on this workspace, or -1 for default. Ignored if activating an existing window |
timestamp | Event timestamp |

### cinnamon_app_open_new_window ()

    void
    cinnamon_app_open_new_window (CinnamonApp *app,
                                  int workspace);

Request that the application create a new window.

#### Parameters

app | a CinnamonApp |
workspace | open on this workspace, or -1 for default |

### cinnamon_app_can_open_new_window ()

    gboolean
    cinnamon_app_can_open_new_window (CinnamonApp *app);

Returns `TRUE` if the app supports opening a new window through `cinnamon_app_open_new_window()` (ie, if calling that function will result in actually opening a new window and not something else, like presenting the most recently active one)

#### Parameters

app | a CinnamonApp |

### cinnamon_app_get_state ()

    CinnamonAppState
    cinnamon_app_get_state (CinnamonApp *app);

#### Parameters

app | a CinnamonApp |

#### Returns

State of the application

### cinnamon_app_request_quit ()

    gboolean
    cinnamon_app_request_quit (CinnamonApp *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.

#### Parameters

app | A CinnamonApp |

#### Returns

`TRUE` if a quit request is supported for this application

### cinnamon_app_get_n_windows ()

    guint
    cinnamon_app_get_n_windows (CinnamonApp *app);

### cinnamon_app_get_windows ()

    GSList *
    cinnamon_app_get_windows (CinnamonApp *app);

Get the toplevel, interesting 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]

### cinnamon_app_get_pids ()

    GSList *
    cinnamon_app_get_pids (CinnamonApp *app);

#### Parameters

app | a CinnamonApp |

#### Returns

An unordered list of process identifiers associated with this application.

[transfer container][element-type int]

### cinnamon_app_is_on_workspace ()

    gboolean
    cinnamon_app_is_on_workspace (CinnamonApp *app,
                                  MetaWorkspace *workspace);

### cinnamon_app_launch ()

    gboolean
    cinnamon_app_launch (CinnamonApp *app,
                         guint timestamp,
                         GList *uris,
                         int workspace,
                         char **startup_id,
                         GError **error);

#### Parameters

timestamp | Event timestamp, or 0 for current event timestamp |
uris | List of uris to pass to application. | [element-type utf8]
workspace | Start on this workspace, or -1 for default |
startup_id | Returned startup notification ID, or `NULL` if none. | [out]
error | A GError |

### cinnamon_app_launch_offloaded ()

    gboolean
    cinnamon_app_launch_offloaded (CinnamonApp *app,
                                   guint timestamp,
                                   GList *uris,
                                   int workspace,
                                   char **startup_id,
                                   GError **error);

Launch an application using the dedicated gpu (if available)

#### Parameters

timestamp | Event timestamp, or 0 for current event timestamp |
uris | List of uris to pass to application. | [element-type utf8]
workspace | Start on this workspace, or -1 for default |
startup_id | Returned startup notification ID, or `NULL` if none. | [out]
error | A GError |

### cinnamon_app_get_is_flatpak ()

    gboolean
    cinnamon_app_get_is_flatpak (CinnamonApp *app);

#### Parameters

app | a CinnamonApp |

#### Returns

TRUE if app is a flatpak app, FALSE if not

### cinnamon_app_get_flatpak_app_id ()

    char *
    cinnamon_app_get_flatpak_app_id (CinnamonApp *app);

## Types and Values

### enum CinnamonAppState

#### Members

CINNAMON_APP_STATE_STOPPED |  |
CINNAMON_APP_STATE_STARTING |  |
CINNAMON_APP_STATE_RUNNING |  |

## Property Details

### The `“state”` property

      “state”                    CinnamonAppState

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

Owner: CinnamonApp

Flags: Read

Default value: CINNAMON_APP_STATE_STOPPED

## Signal Details

### The `“windows-changed”` signal

    void
    user_function (CinnamonApp *cinnamonapp,
                   gpointer     user_data)

Flags: Run Last