ShellAppUsage

## ShellAppUsage ShellAppUsage — Track application usage/state data |

## Synopsis

    struct              ShellAppUsageClass;
    ShellAppUsage *     shell_app_usage_get_default         (void);
    GSList *            shell_app_usage_get_most_used       (ShellAppUsage *usage,
                                                             const char *context,
                                                             gint max_count);
    int                 shell_app_usage_compare             (ShellAppUsage *self,
                                                             const char *context,
                                                             ShellApp *app_a,
                                                             ShellApp *app_b);

## Description

This class maintains some usage and state statistics for applications by keeping track of the approximate time an application's windows are focused, as well as the last workspace it was seen on. This time tracking is implemented by watching for focus notifications, and computing a time delta between them. Also we watch the GNOME Session "StatusChanged" signal which by default is emitted after 5 minutes to signify idle.

## Details

### struct ShellAppUsageClass

    struct ShellAppUsageClass {
      GObjectClass parent_class;
    };

### shell_app_usage_get_default ()

    ShellAppUsage *     shell_app_usage_get_default         (void);

Returns : | The global ShellAppUsage instance. [transfer none]

### shell_app_usage_get_most_used ()

    GSList *            shell_app_usage_get_most_used       (ShellAppUsage *usage,
                                                             const char *context,
                                                             gint max_count);

Get a list of most popular applications for a given context.

`usage` : | the usage instance to request
`context` : | Activity identifier
`max_count` : | how many applications are requested. Note that the actual list size may be less, or NULL if not enough applications are registered.
Returns : | List of applications. [element-type ShellApp][transfer full]

### shell_app_usage_compare ()

    int                 shell_app_usage_compare             (ShellAppUsage *self,
                                                             const char *context,
                                                             ShellApp *app_a,
                                                             ShellApp *app_b);

Compare `app_a` and `app_b` based on frequency of use.

`self` : | the usage instance to request
`context` : | Activity identifier
`app_a` : | First app
`app_b` : | Second app
Returns : | -1 if `app_a` ranks higher than `app_b`, 1 if `app_b` ranks higher than `app_a`, and 0 if both rank equally.