The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
apps.h File Reference

the programs of the desktop: the .app files. More...

#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  app_t
struct  app_list_t

Macros

#define APPS_DIR   "/usr/share/applications"
#define APP_CATEGORIES   "Accessories", "Development", "Games", "Graphics", "Sound", "System", "Other"
#define APP_ARGS_MAX   16

Functions

app_list_t * apps_load (const char *dir)
 read the .app files of a directory (APPS_DIR for the system ones).
void apps_free (app_list_t *list)
const app_t * apps_find (const app_list_t *list, const char *id)
 the program with this id.
int app_split_exec (const char *exec, char *buffer, char *argv[APP_ARGS_MAX+1])
 split exec into words.

Detailed Description

the programs of the desktop: the .app files.

each program the launcher shows has a file /usr/share/applications/ <id>.app in the settings format of libconf:

[app]
name = Window demo
comment = A test of the window server
exec = heimdemo 2
icon = application-x-executable
category = Development

name and exec must be there. icon is a Tela icon name (the icon library gives "unknown" for a name it does not have). category is one of APP_CATEGORIES; another or no category is "Other". hidden = true keeps the program out of the launcher (it can still be found by its id).

exec is split into words at spaces. a word in double quotes can have spaces in it. the first word is the program: a path, or a name in /bin.

Macro Definition Documentation

◆ APPS_DIR

#define APPS_DIR   "/usr/share/applications"

◆ APP_CATEGORIES

#define APP_CATEGORIES   "Accessories", "Development", "Games", "Graphics", "Sound", "System", "Other"

◆ APP_ARGS_MAX

#define APP_ARGS_MAX   16

Function Documentation

◆ apps_load()

app_list_t * apps_load ( const char * dir)

read the .app files of a directory (APPS_DIR for the system ones).

a file without a name or exec is skipped, with a warning on stderr.

Returns
the list (empty if there is no directory), or NULL (no memory).

◆ apps_free()

void apps_free ( app_list_t * list)

◆ apps_find()

const app_t * apps_find ( const app_list_t * list,
const char * id )

the program with this id.

Returns
it, or NULL.

◆ app_split_exec()

int app_split_exec ( const char * exec,
char * buffer,
char * argv[APP_ARGS_MAX+1] )

split exec into words.

Parameters
bufferreceives the words (it must hold strlen(exec) + 1 bytes).
argvreceives up to APP_ARGS_MAX words and a NULL.
Returns
the number of words, or -1 (none, too many, or a quote that is not closed).