While we now have the ability to create applications, we are limited to one script. This becomes impossible to manage as your application grows larger. This is where Packaging comes in. Packaging your app in with the GJS GTK Application Specification makes it easy to set dependencies, start your application, distribute your application, and perhaps most importantly create large, multi-file projects.

You can read more about the GJS GTK Application Specification here.

The specification is quite long and complex; luckily applications have already implemented it for you! In the next guide we will be explaining how to use GNOME Builder to create a packaged application.

Setting dependencies with packaging

Before using any import from you should set which version you expect to use.

    'Gtk': '3.0',
    'Gio': '2.0'

pkg is a global utility object to access the packaging tools GJS provides. pkg.require() receives an object mapping dependency names to version strings. Always declare this before you use or import a library, ideally at the start of the file. This replaces

Last Updated: 3/28/2022, 6:57:58 PM
Contributors: Evan Welsh, Sonny Piers