2 title: Creating a New Application
5 Applications are either software designed to perform a specific task during a limited amount of
6 time, or graphical applications presenting the user with an interface they can interact with.
8 Such applications are executed by `applaunchd`, the AGL
9 [application launcher service](1_Application_Framework/2_Application_Startup/).
13 In order to be enumerated by `applaunchd`, applications must provide the a `.desktop` file, as
14 defined by the [Desktop Entry specification](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html).
16 The desktop entry file should be installed to `/usr/share/applications` (or the `applications`
17 sub-directory of any entry present in the `XDG_DATA_DIRS` environment variable) and have a
18 meaningful name. It is considered good practice to use reverse-DNS notation for the desktop
19 entry file name, following the recommendations of the [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names):
20 - this avoids potential name collisions with other desktop entry files
21 - it makes it easier to enable [D-Bus activation](#d-bus-activation) during the application
22 development cycle if needed
23 - for [graphical applications](#graphical-applications), it ensures the chosen Wayland `app-id`
26 Such a file must contain at least the following keys:
27 - `Type`: desktop entry type, must be set to `Application`
28 - `Name`: application name, as it should be displayed in menus and application launchers
29 - `Exec`: full path to the main executable
31 Below is an example of a minimal desktop entry file:
36 Name=Example Application
37 Exec=/usr/bin/example-app
40 Graphical applications must also provide an `Icon` entry pointing to the application icon.
41 The value for this entry must either be the full path to the icon's file or, for icons part
42 of an existing [icon theme](https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html),
43 the name of an element of this theme.
45 In addition, a number of optional fields can be used to change how `applaunchd` will consider the
47 - `Version`: version of the Desktop Entry Specification the file conforms to, must be `1.5`
48 - `Hidden`: boolean value, if `true` the application is always ignored by `applaunchd` and
49 won't be listed nor executed
50 - `Terminal`: boolean value, if `true` the application is excluded when requesting the list of
51 graphical applications from `applaunchd`
52 - `DBusActivatable`: boolean value, must be `true` for [D-Bus activated applications](#d-bus-activation)
53 - `Implements`: list of D-Bus interfaces the application implements, only used for D-Bus activated
56 Finally, graphical applications may also define the `StartupWMClass` key in some cases. Please
57 refer to the [graphical applications](#graphical-applications) section for more information.
61 Similarly to [services](2_Creating_a_New_Service.md/#d-bus-activation), applications can
62 also be activated through D-Bus.
64 Such applications must name their `.desktop` file after the D-Bus name they register. In addition,
65 this file must contain the following entries:
69 Implements=IFACE1;IFACE2;...
72 Where `IFACEn` are the names of the D-Bus interfaces the application implements.
74 In addition, they must provide a D-Bus service file named `NAME.service` and installed
75 to `/usr/share/dbus-1/services`.
77 The contents of the D-Bus service file must be the following:
82 Exec=/path/to/executable
85 For example, an application registering the `org.automotivelinux.Example` D-Bus name
86 and implementing the `org.automotivelinux.Example.Search1` and `org.automotivelinux.Example.Execute1`
87 interfaces would provide the following files:
89 * Desktop entry (`/usr/share/applications/org.automotivelinux.Example.desktop`):
95 Name=Example Application
96 Exec=/usr/bin/example-app
100 Implements=org.automotivelinux.Example.Search1;org.automotivelinux.Example.Execute1
103 * D-Bus service file (`/usr/share/dbus-1/services/org.automotivelinux.Example.service`):
107 Name=org.automotivelinux.Example
108 Exec=/usr/bin/example-app
111 *Note: in addition to their own D-Bus interface, D-Bus activated applications must also
112 implement the `org.freedesktop.Application` interface as defined in the
113 [Desktop Entry specification](https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s07.html).*
115 # Graphical applications
117 In addition, graphical applications need to comply with a few more requirements:
119 1. Each application must set a Wayland application ID appropriately as soon as its main window
122 2. The `app-id` must be specified in the desktop entry file by adding the following line:
125 StartupWMClass=APP_ID
128 3. The desktop entry file must be named `APP_ID.desktop`.
130 Doing so will ensure other software can associate the actual `app-id` to the proper application.
132 *Note: application ID's are set using the [XDG toplevel](https://wayland-book.com/xdg-shell-basics/xdg-toplevel.html)