Question

To initialize a GTK application, I must pass along an application id. I've done a bit of Googling and I found the minimum requirements of an application ID, but no guidelines as to how it should be named.

I've also found some code snippets, where the convention seemed to be a bit like Java's package name convention.

How should I name my application ID?

Was it helpful?

Solution

You can name it anything you want within the requirements, but the convention is a reverse domain name followed by an application name: com.stackoverflow.QuestionAnswerer.

OTHER TIPS

As in https://developer.gnome.org/ChooseApplicationID/

Application identifiers follow the same format as D-Bus well-known bus names. For convenience, the restrictions on application identifiers are reproduced here:

  • Application identifiers are composed of 1 or more elements separated by a period (.) character. All elements must contain at least one character.

  • Each element must only contain the ASCII characters [A-Z][a-z][0-9]_-, with - discouraged in new application identifiers. Each element must not begin with a digit.

  • Application identifiers must contain at least one . (period) character (and thus at least two elements).

  • Application identifiers must not begin with a . (period) character.

  • Application identifiers must not exceed 255 characters.

Note that the hyphen (-) character is allowed in application identifiers, but is problematic or not allowed in various specifications and APIs that refer to D-Bus, such as Flatpak application IDs, the DBusActivatable interface in the Desktop Entry Specification, and the convention that an application's "main" interface and object path resemble its application identifier and bus name. To avoid situations that require special-case handling, it is recommended that new application identifiers consistently replace hyphens with underscores.

Like D-Bus interface names, application identifiers should start with the reversed DNS domain name of the author of the interface (in lower-case), and it is conventional for the rest of the application identifier to consist of words run together, with initial capital letters.

As with D-Bus interface names, if the author's DNS domain name contains hyphen/minus characters they should be replaced by underscores, and if it contains leading digits they should be escaped by prepending an underscore. For example, if the owner of 7-zip.org used an application identifier for an archiving application, it might be named org._7_zip.Archiver.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top