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