├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── template ├── .editorconfig ├── .github │ └── workflows │ │ └── main.yml ├── .gitignore ├── .vscode │ ├── extensions.json │ └── launch.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── com.github.ORG.APP.yml ├── data │ ├── 128.svg │ ├── 16.svg │ ├── 24.svg │ ├── 32.svg │ ├── 48.svg │ ├── 64.svg │ ├── APP.appdata.xml.in │ ├── APP.desktop.in │ ├── gresource.xml │ ├── gschema.xml │ └── meson.build ├── meson.build ├── meson │ └── post_install.py ├── po │ ├── LINGUAS │ ├── POTFILES │ └── meson.build ├── site │ ├── README.md │ ├── com.github.ORG.APP.flatpakref │ ├── icons │ │ ├── browser-download-symbolic.svg │ │ ├── bug-symbolic.svg │ │ ├── help-contents-symbolic.svg │ │ ├── io.elementary.appcenter-symbolic.svg │ │ ├── positive-feedback-symbolic.svg │ │ └── text-x-copying-symbolic.svg │ ├── index.css │ ├── index.html │ └── index.js ├── src │ ├── Application.vala │ ├── Constants │ │ ├── Colors.vala │ │ └── Config.vala.in │ ├── MainWindow.vala │ └── Widgets │ │ └── HeaderBar.vala └── task │ ├── build │ ├── install │ ├── package │ ├── preview-in-appcenter │ ├── publish │ ├── run │ ├── run-package │ ├── take-screenshots │ └── update-translations └── watson /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | builddir/ 3 | .flatpak-builder/ 4 | 5 | # temp files created by elementary OS code 6 | *~ 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [1.0.0] - YYYY-MM-DD (In progress…) 8 | 9 | ### Added 10 | 11 | - Initial release. 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Watson 2 | 3 | > “It’s elementary, my dear…” 4 | 5 | __A best-practices application template for elementary OS 6 (Odin).__ 6 | 7 | [![Looping GIF of a snippet of Aral Balkan’s video introducing Watson.](https://videoapi-muybridge.vimeocdn.com/animated-thumbnails/image/9710a275-8b39-40f9-b8c1-1c720883f364.gif?ClientID=vimeo-core-prod&Date=1633623413&Signature=b1d86a2778a3aa9e4ca472047355a6d4f43009be)](https://vimeo.com/625472483) 8 | 9 | [Watch the introductory screencast](https://vimeo.com/625472483). 10 | 11 | __Status: Beta.__ 12 | 13 | I’ve now backported everything I learned and created while making [Comet](https://github.com/small-tech/comet) into Watson. 14 | 15 | Once Comet is on the AppCenter and I’m happy that Watson captures and supports the full elementary OS development cycle, I’ll remove the Beta status. 16 | 17 | - _For feedback, ideas, and suggestions, please see [Discussions](https://github.com/small-tech/watson/discussions)._ 18 | - _For bug reports for Watson and generated projects, please [open an issue](https://github.com/small-tech/watson/issues)._ 19 | - __Want to jump right in? See [Getting Started](#getting-started).__ 20 | 21 | [Want the wallpaper?](#get-the-wallpaper) 22 | 23 | ## What Watson is (and what Watson is not). 24 | 25 | Watson gets you up and running quickly with a bare-bones single-window elementary OS 6 (Odin) app that is based on the [elementary OS Developer Documentation](https://docs.elementary.io/develop/) as well as a review of the conventions employed by the core apps that ship with elementary OS (like [Code](https://github.com/elementary/code/) and [Calculator](https://github.com/elementary/calculator)). 26 | 27 | It also makes it equally easy for other developers to build and run your application on their own machines after they clone your project’s repository. 28 | 29 | Watson includes a number of scripts – to create and run Flatpak packages, update translations, and even take screenshots of your app and preview your app in AppCenter – that make the everyday tasks of working with your application easier. 30 | 31 | Finally, Watson includes a simple web site for your app that’s automatically generated from your app’s metadata and contains a basic, progressively-enhanced and accessible carousel of your screenshots as well as a Flatpak repository for your app where people can sideload your app from. To host the generated site, you simply have to turn on GitHub Pages for your app and use the provided publish task script to publish your app and push to your GitHub repository. (You can also host your site on any static host, e.g., using [Site.js](https://sitejs.org). If you decide to put your app on the elementary OS AppCenter you can also uncomment a “Get It On AppCenter” button that will open AppCenter at your app’s page. To see an example how you can build on and customise this base site, see the web site for [Comet](https://comet.small-web.org). 32 | 33 | When deciding what to include and what to leave out of the generated app, the guiding principle is to include base functionality expected of any elementary OS 6 app. The goal is for you to only have to add to the generated template, not remove from it or change the generated code for common types of apps (with the understanding that multi-window applications and highly custom apps might require a bit of fiddling). 34 | 35 | __Most importantly, the generated skeletal app complies with the [elementary OS Human Interface Guidelines](https://docs.elementary.io/hig/) and follows other recommended elementary OS 6 conventions like [coding style](https://docs.elementary.io/develop/writing-apps/code-style).__ _If you haven’t already done so, please read through both of those important resources before continuing. Also, to refer to language or library details during development, bookmark [Valadoc](https://valadoc.org/)._ 36 | 37 | Once you’ve made the generated app your own by customising it and adding to it, you can submit it for inclusion in the elementary OS [AppCenter](https://docs.elementary.io/develop/appcenter/publishing-requirements) as a curated app. 38 | 39 | ___Watson is not a substitute for knowing what you’re doing.__ Watson is meant to lower the barrier of entry to creating an elementary OS application by automating the start of a new project to ensure you do not misconfigure your project or leave out important aspects (like window state preservation or translations). So, again, please read the above documents before starting to develop apps for elementary OS._ 40 | 41 | ## Goals 42 | 43 | 1. The time from when a developer decides to make an elementary OS app to when they have a working project using Watson should be < 60 seconds. 44 | 45 | 2. The time from when a developer clones a Watson-generated elementary OS application to when they have it up and running on their own machine should be < 60 seconds. 46 | 47 | Furthermore, the generated project must: 48 | 49 | - Adhere to platform [human interface guidelines](https://docs.elementary.io/hig/), [conventions](https://docs.elementary.io/develop/writing-apps/code-style), and [other recommended practices](https://docs.elementary.io/develop/). 50 | 51 | - Be [maintainable](https://www.oreilly.com/content/what-is-maintainability/). 52 | 53 | - Adhere to [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) (Don’t Repeat Yourself) principles. 54 | 55 | ## Getting started 56 | 57 | ### On GitHub: 58 | 59 | 1. __Press the green [“Use this template” button](https://github.com/small-tech/watson#repo-content-pjax-container)__ for this repository to create your new project’s repository using Watson as the template. 60 | 61 | ### On your development machine: 62 | 63 | 2. __Clone your project__ and switch to its directory in Terminal: 64 | 65 | ```shell 66 | git clone git@github.com:/.git 67 | cd 68 | ``` 69 | 70 | 3. __Initialise your project__: 71 | 72 | ```shell 73 | ./watson 74 | ``` 75 | 76 | > __Note on the GitHub-centric workflow:__ The elementary OS AppCenter currently ties application bundle IDs and the directory structure for assets, etc., to the GitHub project. So your project’s application bundle ID will be something like com.github.small_tech.comet (the init script will automatically convert dashes to underscores as per flatpak’s naming requirements). I have raised my concerns about this both from a legal perspective [as it is a trademark violation](https://github.com/elementary/appcenter/discussions/1622) and, more generally, [because it gives Microsoft a de-facto veto right on what apps are allowed on elementary OS](https://github.com/elementary/houston/issues/436#issuecomment-905554984). I do hope that this decision will be reviewed going forward. In the meanwhile, however, Watson is designed to make full use of the current system to make setting up a new elementary OS project as simple as possible while following all relevant platform guidelines and encouraging good practices. – [Aral](https://ar.al) 77 | 78 | ## What to expect 79 | 80 | ### Interactive app configuration screens 81 | 82 | Watson will ask for your app details in a series of graphical dialogue windows and update the necessary bits of the template files (application bundle IDs, asset paths, etc.) to customise them for your project based on your answers. 83 | 84 | It will also replace this README and the CHANGELOG with your application’s versions, recreate the git repository (so you start with a fresh history), make an initial commit, and set up your git remote so `origin` points to your repository. 85 | 86 | Next, Watson will run the install task (`task/install`). 87 | 88 | > The install task is also what developers who clone your project will run to ensure that they can build and run your project. 89 | 90 | ### The install task 91 | 92 | The install task first checks whether you have the [elementary OS development libraries](https://docs.elementary.io/develop/writing-apps/the-basic-setup#development-libraries) installed and asks you to install them if it can’t find them. 93 | 94 | > The elementary OS development libraries – also known as the elementary OS Software Development Kit (SDK) – are a [metapackage of elementary OS libraries](https://github.com/elementary/metapackages) required when creating apps for elementary OS. You can see which libraries are included in the SDK based on the architecture of your development machine by reviewing the following metapackage definitions: [AMD64](https://github.com/elementary/metapackages/blob/master/elementary-sdk-amd64), [ARM64](https://github.com/elementary/metapackages/blob/master/elementary-sdk-arm64), [ARMHF](https://github.com/elementary/metapackages/blob/master/elementary-sdk-armhf). 95 | 96 | Next, Watson will check if you have [VSCodium](https://vscodium.com) installed. If you do, it will check whether or not you have useful set of VSCodium extensions for elementary OS development installed and ask you to install them if you don’t. 97 | 98 | > You do _not_ need to use VSCodium to create elementary OS apps. You can, for instance, use elementary OS [Code](https://docs.elementary.io/develop/writing-apps/the-basic-setup#code), which comes preinstalled, or a different third-party editor like [Builder](https://apps.gnome.org/en/app/org.gnome.Builder/). However, if you do have VSCodium installed, there are a number of extensions that will make creating your elementary OS app easier ([Vala](https://github.com/Prince781/vala-vscode), [Meson](https://github.com/asabil/vscode-meson), [CodeLLDB](https://github.com/vadimcn/vscode-lldb), [XML](https://github.com/redhat-developer/vscode-xml), [YAML](https://github.com/redhat-developer/vscode-yaml)). If Watson cannot find these extensions installed, it will ask you if you’d like to install them now. With these extensions installed, once you’ve initialised your project, you can simple open it in VSCodium and hit F5 to run/debug it and Ctrl + Shift + B → _Build all targets_ to rebuild it after making changes. You will also get code intelligence, etc., for all your source files. Finally, your project will also inform VSCodium of the set of recommended extensions for your project so even if you choose not to install them now, you can easily find and install them later yourself. 99 | 100 | ### Post install 101 | 102 | Once the install task is done, Watson will delete itself, leaving only your project behind. 103 | 104 | It will also commit and push the changes to your git repository. 105 | 106 | ___And that’s it!___ 107 | 108 | At this point, your project is ready and you can customise the template further to create your own unique and wonderful app, knowing you have a base that adheres to elementary OS guidelines. 109 | 110 | You can also run your project using the run script: 111 | 112 | ``` 113 | task/run 114 | ``` 115 | 116 | Or, if you’re using VSCodium, just open your project and hit F5 to run/debug it and Ctrl + Shift + B → _Build all targets_ to rebuild it after making changes. 117 | 118 | You can find more task scripts in the `task` folder of your project and the workflow is also documented in the README file that’s generated for your project. 119 | 120 | Here’s hoping Watson will make it easier for you to start building and maintaining excellent apps for elementary OS. 121 | 122 | ## What’s included? 123 | 124 | - A prompt to install the [elementary OS development libraries](https://docs.elementary.io/develop/writing-apps/the-basic-setup#development-libraries) if they don’t already exist on your machine. 125 | 126 | - A prompt to install recommended [VSCodium](https://vscodium.com/) Vala development and debugging extensions ([Vala](https://github.com/Prince781/vala-vscode), [Meson](https://github.com/asabil/vscode-meson), [CodeLLDB](https://github.com/vadimcn/vscode-lldb), [EditorConfig for VS Code](https://github.com/editorconfig/editorconfig-vscode), [XML](https://github.com/redhat-developer/vscode-xml), [YAML](https://github.com/redhat-developer/vscode-yaml)) if you have VSCodium installed and are missing any of them. 127 | 128 | - VSCodium [launch.json](https://charlesagile.com/vscode-launch-json-and-the-debug-console) for [CodeLLDB](https://github.com/vadimcn/vscode-lldb) (press F5 to run/debug your project in VSCodium). 129 | 130 | - A basic `Application` class that instantiates a single window (`MainWindow`). 131 | 132 | - A basic [Handy application window](https://gnome.pages.gitlab.gnome.org/libhandy/) (`MainWindow`). (While this is not yet reflected in the [elementary OS Developer Documentation](https://docs.elementary.io/develop/), the core apps that ship with elementary OS – like Code and Calculator – all use the [Handy library](https://gnome.pages.gitlab.gnome.org/libhandy/) so I’ve based the template on them.) 133 | 134 | - A basic [Handy header bar](https://gnome.pages.gitlab.gnome.org/libhandy/doc/1-latest/HdyHeaderBar.html), as part of the basic window. 135 | 136 | - [Actions](https://docs.elementary.io/develop/apis/actions#glib-simpleaction) wired up for quit and fullscreen with keyboard shortcut accelerators (Ctrl+Q, and F11, respectively). The code is set up so you can easily expand the list of actions and accelerators with your own in a maintainable manner. 137 | 138 | - [Granite](https://valadoc.org/granite/Granite.html) library for application [launchers](https://docs.elementary.io/develop/apis/launchers), [badges](https://docs.elementary.io/develop/apis/launchers#badges), [progress bars](https://docs.elementary.io/develop/apis/launchers#progress-bars), etc. 139 | 140 | - [Window state preservation](https://docs.elementary.io/develop/apis/state-saving) using a [gschema.xml](https://docs.elementary.io/develop/apis/state-saving#define-settings-keys) file and [GSettings](https://valadoc.org/gio-2.0/GLib.Settings.html). Set up to automatically save and restore the last window state (dimensions, location, and whether it is maximised or fullscreen). 141 | 142 | - Set up for [custom resources](https://docs.elementary.io/develop/apis/gresource) ([custom icons](https://docs.elementary.io/develop/apis/gresource#icons), etc.). No custom resources are provided but you can easily add your own to the `data/` directory and declare them in the provided [gresource.xml](https://docs.elementary.io/develop/apis/gresource) file. 143 | 144 | - [Colour scheme](https://docs.elementary.io/develop/apis/color-scheme) support (automatically uses person’s dark/light mode preference and updates the app’s appearance should they change it while the app is running). 145 | 146 | - [elementary OS colours](https://elementary.io/brand#color) as constants. Refer to `Constants.Colors` (US spelling as used elsewhere in the libraries) in your app to access them. 147 | 148 | - [.desktop](https://docs.elementary.io/develop/writing-apps/our-first-app#the-desktop-file) file for information about your app that’s displayed in the Application Menu and Dock. 149 | 150 | - [AppData.xml](https://docs.elementary.io/develop/writing-apps/our-first-app#appdata-xml) file for information need to list your app in AppCenter. 151 | 152 | - [LICENSE](https://docs.elementary.io/develop/writing-apps/our-first-app#legal-stuff) file for the GNU GPL license. 153 | 154 | - [Meson configuration files](https://docs.elementary.io/develop/writing-apps/our-first-app/the-build-system) and a build script. 155 | 156 | - [Support for translations](https://docs.elementary.io/develop/writing-apps/our-first-app/translations) with [GNU gettext via Meson](https://mesonbuild.com/Localisation.html). 157 | 158 | - Placeholder [app icon](https://docs.elementary.io/develop/writing-apps/our-first-app/icons). Just replace the provided ones with your own custom icon. 159 | 160 | - [Flatpak manifest](https://docs.elementary.io/develop/writing-apps/our-first-app/packaging) for packaging your application. 161 | 162 | - [Continuous Integration](https://docs.elementary.io/develop/writing-apps/our-first-app/continuous-integration) GitHub workflow. 163 | 164 | - The recommended [EditorConfig](https://docs.elementary.io/develop/writing-apps/code-style#editorconfig) for elementary OS Code and other compatible editors for enforcing the suggested [code style](https://docs.elementary.io/develop/writing-apps/code-style). 165 | 166 | - Basic [.gitignore file](https://git-scm.com/docs/gitignore) that ensures build directories are not accidentally added to your project. 167 | 168 | - Task for building and running the app (with Meson/Ninja and with Flatpak), updating translations, taking localised screenshots, and previewing your app locally in the elementary OS AppCenter (with support for localisations). 169 | 170 | 171 | 172 | ## What’s _not_ included? 173 | 174 | Watson creates a basic single-window elementary OS application using good practices. 175 | 176 | Watson’s goal with the generated app is that you should only have to either customise existing functionality (e.g., replace the app logo SVGs with your own), use existing functionality (e.g., add your custom icons or your own translations), or add specialised logic to the generated app. So you shouldn’t have to _remove_ any of the generated functionality. This is why there are no sample widgets or even basic layout generated as that will differ from app to app. 177 | 178 | The generated skeleton is just that, the structure you need to quickly get you started with building your own application. 179 | 180 | In other words, Watson does _not_ generate a sample app. For widget demos of the underlying libraries, see the Granite demo (`sudo apt install granite-demo && granite-demo`) and Gtk+ 3 examples/demo (`sudo apt install gtk-3-examples && gtk3-demo`). 181 | 182 | Watson is also not meant to teach you how to build an elementary OS app (see the [elementary OS Developer Documentation](https://docs.elementary.io/develop/)) and is not a substitute for knowing and applying the [elementary OS Human Interface Guidelines](https://docs.elementary.io/hig/) as you develop your app. 183 | 184 | Finally, while Watson will install the elementary OS development tools and even the recommended VSCodium extensions for you if you ask it to, __you need to configure your GitHub account and set up git on your machine yourself.__ For instructions on how to do this, please see the [Basic Setup](https://docs.elementary.io/develop/writing-apps/the-basic-setup) section of the [elementary OS Developer Documentation](https://docs.elementary.io/develop/). 185 | 186 | ## Common functionality you might want to add to your app 187 | 188 | Here are some quick links showing you how to add common functionality to your app after you’ve generated it: 189 | 190 | - [Notifications](https://docs.elementary.io/develop/apis/notifications) 191 | - [Launchers (dock integration; badges, progress bars, etc.)](https://docs.elementary.io/develop/apis/launchers) 192 | 193 | ## General resources 194 | 195 | At the risk of sounding like a broken record, please work your way through the [elementary OS Developer Documentation](https://docs.elementary.io/develop/)) and [elementary OS Human Interface Guidelines](https://docs.elementary.io/hig/) before starting to create an app for elementary OS 6. 196 | 197 | Also please review the AppCenter [publishing requirements](https://docs.elementary.io/develop/appcenter/publishing-requirements) before you [submit your app](https://developer.elementary.io/). 198 | 199 | 200 | Other important references include: 201 | 202 | - [Vala documentation](https://valadoc.org/) 203 | - [Handy documentation](https://gnome.pages.gitlab.gnome.org/libhandy/) 204 | - [Gtk3 documentation](https://docs.gtk.org/gtk3/) 205 | - [Gtk4 documentation]() (elementary OS does not use Gtk4 yet but since elementary OS apps are Flatpaks, you can, if you like, use it in your own apps. Note that this will currently result in a large download if the person downloading your app doesn’t already have the Gtk4 platform image installed. Here’s [a good guide if you want to use Gtk4 in your apps today](https://mrmonkington.github.io/how-to-build-an-only-slightly-less-than-trivial-gtk4-app-using-flatpak.html). Bear in mind that elementary OS will move to Gtk4 eventually so it’s good to start learning about it today.) 206 | - The elementary OS core projects – [Code](https://github.com/elementary/code/), [Calculator](https://github.com/elementary/calculator), [Tasks](https://github.com/elementary/tasks), [Calendar](https://github.com/elementary/calendar), etc. – are a valuable learning resource. Read through the code to see how they do things. (See [elementary OS on GitHub](https://github.com/elementary) for more.) 207 | 208 | ## Similar projects 209 | 210 | - [Valdo](https://github.com/Prince781/valdo) by [Princeton Ferro](https://github.com/Prince781) (of Vala Language Server fame. Make sure you watch his excellent [elementary Developer Weekend](https://edw.elementary.io) talk on [Improving App Development in Vala](https://edw.elementary.io/#improving-app-development-in-vala-by-princeton-ferro)). Valdo is an app that helps you create a new Vala project from a repository of templates. Valdo is not designed specifically for elementary OS but it does feature an elementary OS app template. 211 | 212 | - [Develop](https://github.com/alcadica/develop) is an app for elementary OS 5 (Hera) that has starters for apps, [Switchboard](https://github.com/elementary/switchboard) [Plugs](https://github.com/elementary?q=switchboard-plug#org-repositories), and [Wingpanel](https://github.com/elementary/wingpanel) indicators. 213 | 214 | ## Get the wallpaper 215 | 216 | ![Illustration, Sherlock Holmes, Watson, Enola Holmes and the three cats from Catts are in a swamp full of alligators. Sherlock is standing on a makeshift wooden bridge examining a bird (one foot on an alligator’s nose). Watson is in the swamp gathering more wood for the bridge. Enola and the blue cat are in a row boat in the background. The purple and green cats are on branches.](https://small-tech.org/downloads/watson/wallpaper/watson-wallpaper-4k-by-margo-de-weerdt-small-technology-foundation.jpg) 217 | 218 | The wallpaper you see in the screencast was commissioned for Watson from the singular [Margo de Weerdt](https://www.margodeweerdt.com/). And you’re welcome to download and use it in all its 4K glory on your own computer if you like. 219 | 220 | _(Also available [with shallower depth of field](https://small-tech.org/downloads/watson/wallpaper/watson-wallpaper-4k-shallow-depth-of-field-by-margo-de-weerdt-small-technology-foundation.jpg) – and [even shallower depth of field](https://small-tech.org/downloads/watson/wallpaper/watson-wallpaper-4k-even-shallower-depth-of-field-by-margo-de-weerdt-and-aral-balkan-small-technology-foundation.jpg) – which you might prefer if you place icons on your desktop so they don’t get lost in the detail.)_ 221 | 222 | Released under [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/). Please credit [Margo de Weerdt](https://www.margodeweerdt.com/) and [Watson](https://github.com/small-tech/watson) by [Small Technology Foundation](https://small-tech.org). 223 | 224 | ## Like this? Fund us! 225 | 226 | [Small Technology Foundation](https://small-tech.org) is a tiny, independent not-for-profit. 227 | 228 | We exist in part thanks to patronage by people like you. If you share [our vision](https://small-tech.org/about/#small-technology) and want to support our work, please [become a patron or donate to us](https://small-tech.org/fund-us) today and help us continue to exist. 229 | 230 | ## Copyright 231 | 232 | © 2021-present [Aral Balkan](https://ar.al), [Small Technology Foundation](https://small-tech.org). 233 | 234 | ## License 235 | 236 | [GPL version 3.0](./LICENSE) 237 | -------------------------------------------------------------------------------- /template/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig 2 | # Based on https://docs.elementary.io/develop/writing-apps/code-style#editorconfig 3 | root = true 4 | 5 | # elementary defaults 6 | [*] 7 | charset = utf-8 8 | end_of_line = lf 9 | indent_size = tab 10 | indent_style = space 11 | insert_final_newline = true 12 | max_line_length = 80 13 | tab_width = 4 14 | 15 | # Markup files 16 | [{*.html,*.xml,*.xml.in,*.yml}] 17 | tab_width = 2 18 | -------------------------------------------------------------------------------- /template/.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | # This workflow will run for any pull request or pushed commit 4 | on: [push, pull_request] 5 | 6 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 7 | jobs: 8 | # This workflow contains a single job called "flatpak" 9 | flatpak: 10 | # The type of runner that the job will run on 11 | runs-on: ubuntu-latest 12 | 13 | # This job runs in a special container designed for building Flatpaks for AppCenter 14 | container: 15 | image: ghcr.io/elementary/flatpak-platform/runtime:6 16 | options: --privileged 17 | 18 | # Steps represent a sequence of tasks that will be executed as part of the job 19 | steps: 20 | # Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it 21 | - uses: actions/checkout@v2 22 | 23 | # Builds your flatpak manifest using the Flatpak Builder action 24 | - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v3 25 | with: 26 | # This is the name of the Bundle file we're building and can be anything you like 27 | bundle: {APP.NAMESPACE}.flatpak 28 | # This uses your app's RDNN ID 29 | manifest-path: com.github.{GITHUB.ORG}.{GITHUB.APP}.yml 30 | 31 | # You can automatically run any of the tests you've created as part of this workflow 32 | run-tests: true 33 | 34 | # These lines specify the location of the elementary Runtime and Sdk 35 | repository-name: appcenter 36 | repository-url: https://flatpak.elementary.io/repo.flatpakrepo 37 | cache-key: "flatpak-builder-${{ github.sha }}" 38 | -------------------------------------------------------------------------------- /template/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | builddir/ 3 | .flatpak-builder/ 4 | 5 | # temp files created by elementary OS code 6 | *~ 7 | -------------------------------------------------------------------------------- /template/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "prince781.vala", 4 | "asabil.meson", 5 | "vadimcn.vscode-lldb", 6 | "editorconfig.editorconfig", 7 | "redhat.vscode-xml", 8 | "redhat.vscode-yaml" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /template/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // To launch and debug your app in VSCodium, press F5 3 | // (or press the start debugging/play button on 4 | // the Run and Debug view.) 5 | // 6 | // Note: you must install the CodeLLDB VSCodium 7 | // ===== extension and have run the Meson: Build task 8 | // for this to work. (To install all necessary 9 | // extensions, including Meson and Vala, run the 10 | // tasks/setup-vscodium task.) 11 | // 12 | // For more information on Launch configurations, see: 13 | // https://go.microsoft.com/fwlink/?linkid=830387 14 | "version": "0.2.0", 15 | "configurations": [ 16 | { 17 | "type": "lldb", 18 | "request": "launch", 19 | "name": "Debug", 20 | "program": "${workspaceFolder}/build/com.github.{GITHUB.ORG}.{GITHUB.APP}", 21 | "args": [], 22 | "cwd": "${workspaceFolder}" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /template/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [1.0.0] - YYYY-MM-DD (In progress…) 8 | 9 | ### Added 10 | 11 | - Initial release. 12 | -------------------------------------------------------------------------------- /template/README.md: -------------------------------------------------------------------------------- 1 | # {APP.NAME} 2 | 3 | ![{APP.NAME} icon](./data/128.svg) 4 | 5 | {APP.DESCRIPTION} 6 | 7 | [![Get it on AppCenter](https://appcenter.elementary.io/badge.svg)](https://appcenter.elementary.io/com.github.{GITHUB.ORG}.{GITHUB.APP}]) 8 | 9 | ## System requirements 10 | 11 | - [elementary OS](https://elementary.io) 6 (Odin) 12 | 13 | ## Developer notes 14 | 15 | ### Getting started 16 | 17 | Clone this repository and run the install task: 18 | 19 | ```shell 20 | task/install 21 | ``` 22 | 23 | You can now run the app from either the _Applications Menu_ or using the run task: 24 | 25 | ```shell 26 | task/run 27 | ``` 28 | 29 | ### About 30 | 31 | This project is written in [Vala](https://valadoc.org/) and follows the following elementary OS guidelines: 32 | 33 | - [Human Interface Guidelines](https://docs.elementary.io/hig/) 34 | - [Developer Guidelines](https://docs.elementary.io/develop/) 35 | - [Coding style](https://docs.elementary.io/develop/writing-apps/code-style) 36 | 37 | Please take some time to familiarise yourself with those documents before continuing. 38 | 39 | To get your system ready to develop for elementary OS, please see the [Basic Setup](https://docs.elementary.io/develop/writing-apps/the-basic-setup) section of the [elementary OS Developer Documentation](https://docs.elementary.io/develop/). 40 | 41 | ### Tasks 42 | 43 | #### Install 44 | 45 | Configures and runs the build, installs settings-related features and translations and refreshes the icon cache. 46 | 47 | Run this after you clone this repository to get a working build. 48 | 49 | ```shell 50 | task/install 51 | ``` 52 | 53 | #### Build 54 | 55 | Builds the project. 56 | 57 | ```shell 58 | task/build 59 | ``` 60 | 61 | #### Run 62 | 63 | Builds and runs the executable. 64 | 65 | ```shell 66 | task/run 67 | ``` 68 | 69 | #### Package 70 | 71 | Creates a Flatpak package. 72 | 73 | ```shell 74 | task/package 75 | ``` 76 | 77 | #### Run Package 78 | 79 | Creates and runs a Flatpak package. 80 | 81 | ```shell 82 | task/run-package 83 | ``` 84 | 85 | #### Take screenshots 86 | 87 | Takes screenshots of your app in both the light and dark colour schemes and also creates a montage of the two for use in the AppCenter. 88 | 89 | For ideas on how to customise this script for more complicated screenshots, see [the take-screenshots script for Comet](https://github.com/small-tech/comet/blob/main/task/take-screenshots). 90 | 91 | ```shell 92 | task/take-screenshots 93 | ``` 94 | 95 | > You must push the generated screenshots folder to your GitHub repository before the screenshot will appear when you preview your app in AppCenter. 96 | 97 | #### Publish 98 | 99 | There is a simple web site for {APP.NAME} in the _docs/_ folder. 100 | 101 | If GitHub pages is enabled for the app, you can view the site at https://{GITHUB.ORG.ORIGINAL}.github.io/{GITHUB.APP.ORIGINAL} 102 | 103 | The site has an Install button that links to the Flatpak repository. People can use this button to sideload the app directly from its website. 104 | 105 | To publish this Flatpak repository, use this task: 106 | 107 | ```shell 108 | task/publish 109 | ``` 110 | 111 | > You must push the generated Flatpak repository to your GitHub repository and enable GitHub pages (or host it elsewhere – e.g., using [Site.js](https://sitejs.org)) before people will be able install your app. 112 | 113 | #### Preview in AppCenter 114 | 115 | Launches app locally in AppCenter so you can preview how it will look when published. 116 | 117 | Optionally, you can specify a language code (e.g., `tr_TR`) to preview a specific localisation. 118 | 119 | ```shell 120 | task/preview-in-appcenter 121 | ``` 122 | 123 | ### App web site 124 | 125 | There is a simple web site for {APP.NAME} in the _docs/_ folder. 126 | 127 | If GitHub pages is enabled for the app, you can view the site at https://{GITHUB.ORG.ORIGINAL}.github.io/{GITHUB.APP.ORIGINAL} 128 | 129 | You do not have to use GitHub pages to host your app’s website. You can use any web server that’s capable of serving static files. You can also use a tool like [Site.js](https://sitejs.org) as a development server to preview your site locally during development. 130 | 131 | The site has an Install button that links to the Flatpak repository. People can use this button to sideload the app directly from its website. (For more information, see the [Publish task](#publish)). 132 | 133 | If you decide to put your app on the elementary OS AppCenter you can also uncomment a “Get It On AppCenter” button that will open AppCenter at your app’s page. 134 | 135 | To see an example how you can build on and customise this base site, see the web site for [Comet](https://comet.small-web.org), which is hosted with [Site.js](https://sitejs.org). 136 | 137 | ### VSCodium 138 | 139 | You do _not_ need to use [VSCodium](https://vscodium.com) to create elementary OS apps. 140 | 141 | You can, for instance, use elementary OS [Code](https://docs.elementary.io/develop/writing-apps/the-basic-setup#code), which comes preinstalled, or a different third-party editor like [Builder](https://apps.gnome.org/en/app/org.gnome.Builder/). 142 | 143 | However, if you do have VSCodium installed, there are a number of extensions that will make creating your elementary OS app easier: 144 | 145 | - [Vala](https://github.com/Prince781/vala-vscode) (`codium --install-extension prince781.vala`) 146 | - [Meson](https://github.com/asabil/vscode-meson) (`codium --install-extension asabil.meson`) 147 | - [CodeLLDB](https://github.com/vadimcn/vscode-lldb) (`codium --install-extension vadimcn.vscode-lldb`) 148 | - [EditorConfig](https://github.com/editorconfig/editorconfig-vscode) (`codium --install-extension editorconfig.editorconfig`) 149 | - [XML](https://github.com/redhat-developer/vscode-xml) (`codium --install-extension redhat.vscode-xml`) 150 | - [YAML](https://github.com/redhat-developer/vscode-yaml) (`codium --install-extension redhat.vscode-yaml`) 151 | 152 | With the Meson and CodeLLDB extensions installed, press Control + Shift + B → _Build all targets_ to build and F5 to run and debug. 153 | 154 | If you need to pass command-line arguments to your app while testing, you can do so by specifying them in the `"args": []` array of [your app’s VSCodium launch configuration](.vscode/launch.json). 155 | 156 | ## Continuous integration 157 | 158 | [Continuous Integration](https://docs.elementary.io/develop/writing-apps/our-first-app/continuous-integration) is set up for this repository. 159 | 160 | ## Submitting the app 161 | 162 | __Note:__ App submissions in elementary OS are currently in Beta. 163 | 164 | Please make sure you [review the AppCenter publishing requirements](https://docs.elementary.io/develop/appcenter/publishing-requirements) before [submitting the app](https://beta.developer.elementary.io/) to the [elementary OS AppCenter](https://appcenter.elementary.io/). 165 | 166 | If anything fails during the Beta process, you can submit your app for review manually by opening a pull request on the [AppCenter Reviews repository](https://github.com/elementary/appcenter-reviews). 167 | 168 | _\* If you know [Elixir](https://elixir-lang.org/), you might want to [contribute to improving the new AppCenter dashboard for elementary OS 6](https://github.com/elementary/appcenter-reviews). They’re looking for help._ 169 | 170 | ### Notes on Stripe API keys for monetised apps 171 | 172 | - Stripe only allows one Stripe Connect connection to each Stripe account. While following the Stripe Connect flow during the app submission process, make sure you create a separate Stripe account under your organisation specifically for elementary OS. 173 | 174 | - Do __not__ add the key that’s displayed in your Stripe account to your _appdata.xml_ file. 175 | 176 | - __DO__ add the key you get from https://beta.developer.elementary.io/submissions/add to your _appdata.xml_ file. 177 | 178 | - Regarding the last two points: just to make things more confusing, the first however many letters of the keys might be the same, leading you to think that the key displayed on the Stripe account _is_ the same key. Don’t fall into that trap. (If you enter the wrong key, it’s not the end of the world. Payments for your app will fail on AppCenter until you issue an update with the correct key listed in your _appdata.xml_ file.) 179 | 180 | ## It’s elementary, my dear… 181 | 182 | This project was initially generated by [Watson](https://github.com/small-tech/watson), a tool for quickly setting up a new elementary OS 6 app that follows platform [human interface](https://docs.elementary.io/hig/) and [development](https://docs.elementary.io/develop/) guidelines. 183 | 184 | ## Copyright and license 185 | 186 | Copyright © {COPYRIGHT.YEAR}-present {COPYRIGHT.NAME} 187 | 188 | Licensed under [GNU GPL version 3.0](./LICENSE). 189 | -------------------------------------------------------------------------------- /template/com.github.ORG.APP.yml: -------------------------------------------------------------------------------- 1 | app-id: com.github.{GITHUB.ORG}.{GITHUB.APP} 2 | 3 | runtime: io.elementary.Platform 4 | runtime-version: '6' 5 | sdk: io.elementary.Sdk 6 | 7 | command: com.github.{GITHUB.ORG}.{GITHUB.APP} 8 | 9 | finish-args: 10 | - '--share=ipc' 11 | - '--socket=fallback-x11' 12 | - '--socket=wayland' 13 | 14 | # Needed to read prefer-color-scheme with Granite.Settings 15 | - '--system-talk-name=org.freedesktop.Accounts' 16 | 17 | modules: 18 | - name: {GITHUB.APP} 19 | buildsystem: meson 20 | sources: 21 | - type: dir 22 | path: . 23 | -------------------------------------------------------------------------------- /template/data/128.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 38 | 42 | 49 | 50 | 52 | 54 | 58 | 62 | 63 | 65 | 69 | 73 | 77 | 81 | 85 | 89 | 90 | 92 | 96 | 100 | 101 | 110 | 112 | 116 | 120 | 124 | 128 | 129 | 139 | 141 | 145 | 149 | 150 | 160 | 169 | 171 | 175 | 179 | 183 | 187 | 191 | 195 | 199 | 200 | 209 | 211 | 215 | 219 | 223 | 227 | 231 | 235 | 239 | 243 | 247 | 251 | 252 | 261 | 263 | 267 | 271 | 275 | 279 | 283 | 287 | 291 | 292 | 301 | 303 | 307 | 311 | 315 | 319 | 323 | 327 | 331 | 332 | 341 | 350 | 352 | 356 | 360 | 364 | 368 | 372 | 373 | 383 | 393 | 403 | 413 | 423 | 433 | 443 | 453 | 462 | 463 | 465 | 466 | 468 | image/svg+xml 469 | 471 | 472 | 473 | 474 | 475 | 478 | 483 | 488 | 489 | 494 | 498 | 502 | 503 | -------------------------------------------------------------------------------- /template/data/16.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 39 | 43 | 50 | 51 | 53 | 55 | 59 | 63 | 64 | 66 | 70 | 74 | 75 | 78 | 82 | 83 | 85 | 89 | 93 | 97 | 101 | 102 | 111 | 120 | 122 | 126 | 130 | 134 | 138 | 142 | 146 | 147 | 156 | 158 | 162 | 166 | 170 | 174 | 178 | 182 | 186 | 190 | 191 | 200 | 202 | 206 | 210 | 214 | 218 | 222 | 226 | 227 | 236 | 238 | 242 | 246 | 250 | 254 | 258 | 262 | 266 | 267 | 276 | 285 | 287 | 291 | 295 | 299 | 303 | 307 | 308 | 318 | 328 | 338 | 348 | 357 | 358 | 360 | 361 | 363 | image/svg+xml 364 | 366 | 367 | 368 | 369 | 370 | 374 | 378 | 382 | 383 | -------------------------------------------------------------------------------- /template/data/24.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 39 | 43 | 50 | 51 | 53 | 55 | 59 | 63 | 64 | 66 | 70 | 74 | 75 | 77 | 81 | 85 | 89 | 90 | 93 | 97 | 98 | 100 | 104 | 108 | 112 | 116 | 117 | 126 | 135 | 137 | 141 | 145 | 149 | 153 | 157 | 161 | 162 | 171 | 173 | 177 | 181 | 185 | 189 | 193 | 197 | 201 | 205 | 206 | 215 | 217 | 221 | 225 | 229 | 233 | 237 | 241 | 242 | 251 | 253 | 257 | 261 | 265 | 269 | 273 | 277 | 281 | 282 | 291 | 300 | 302 | 306 | 310 | 314 | 318 | 322 | 323 | 333 | 343 | 353 | 363 | 373 | 382 | 383 | 385 | 386 | 388 | image/svg+xml 389 | 391 | 392 | 393 | 394 | 395 | 400 | 404 | 408 | 412 | 413 | -------------------------------------------------------------------------------- /template/data/32.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 39 | 43 | 50 | 51 | 53 | 55 | 59 | 63 | 64 | 66 | 70 | 74 | 75 | 77 | 81 | 85 | 89 | 90 | 93 | 97 | 98 | 100 | 104 | 108 | 112 | 116 | 117 | 126 | 136 | 145 | 147 | 151 | 155 | 159 | 163 | 167 | 171 | 172 | 181 | 183 | 187 | 191 | 195 | 199 | 203 | 207 | 211 | 215 | 216 | 225 | 227 | 231 | 235 | 239 | 243 | 247 | 251 | 252 | 261 | 263 | 267 | 271 | 275 | 279 | 283 | 287 | 291 | 292 | 301 | 310 | 312 | 316 | 320 | 324 | 328 | 332 | 333 | 343 | 353 | 363 | 373 | 382 | 383 | 385 | 386 | 388 | image/svg+xml 389 | 391 | 392 | 393 | 394 | 395 | 399 | 404 | 409 | 414 | 415 | -------------------------------------------------------------------------------- /template/data/48.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 39 | 43 | 50 | 51 | 53 | 55 | 59 | 63 | 64 | 66 | 70 | 74 | 78 | 82 | 86 | 87 | 89 | 93 | 97 | 101 | 105 | 109 | 113 | 117 | 118 | 120 | 124 | 128 | 129 | 131 | 135 | 139 | 143 | 147 | 151 | 155 | 156 | 158 | 162 | 166 | 170 | 174 | 178 | 182 | 186 | 190 | 191 | 193 | 197 | 201 | 205 | 209 | 213 | 217 | 218 | 227 | 236 | 245 | 254 | 256 | 260 | 264 | 268 | 272 | 273 | 276 | 280 | 281 | 291 | 301 | 311 | 320 | 330 | 339 | 348 | 357 | 367 | 369 | 373 | 377 | 378 | 388 | 389 | 391 | 392 | 394 | image/svg+xml 395 | 397 | 398 | 399 | 400 | 401 | 405 | 410 | 415 | 416 | 420 | 424 | 428 | 429 | -------------------------------------------------------------------------------- /template/data/64.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 38 | 42 | 49 | 50 | 52 | 54 | 58 | 62 | 63 | 65 | 69 | 73 | 74 | 83 | 85 | 89 | 93 | 97 | 101 | 102 | 112 | 114 | 118 | 122 | 123 | 133 | 142 | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 169 | 178 | 180 | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 213 | 222 | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 249 | 258 | 260 | 264 | 268 | 272 | 276 | 280 | 284 | 288 | 289 | 298 | 307 | 309 | 313 | 317 | 321 | 325 | 329 | 330 | 340 | 350 | 360 | 370 | 379 | 380 | 382 | 383 | 385 | image/svg+xml 386 | 388 | 389 | 390 | 391 | 392 | 397 | 401 | 405 | 409 | 413 | 414 | -------------------------------------------------------------------------------- /template/data/APP.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.github.{GITHUB.ORG}.{GITHUB.APP} 5 | CC0 6 | 11 | 12 | {APP.NAME} 13 | {APP.COMMENT} 14 | 15 |

{APP.DESCRIPTION}

16 |
17 | {COPYRIGHT.NAME} 18 | com.github.{GITHUB.ORG}.{GITHUB.APP}.desktop 19 | 20 | 25 | 26 | 27 | 28 | 38 | #273445 39 | #fafafa 40 | 41 | 53 | 57 | 58 | 59 | 60 | https://github.com/{GITHUB.ORG.ORIGINAL}/{GITHUB.APP.ORIGINAL} 61 | https://github.com/{GITHUB.ORG.ORIGINAL}/{GITHUB.APP.ORIGINAL}/issues 62 | https://github.com/{GITHUB.ORG.ORIGINAL}/{GITHUB.APP.ORIGINAL}#readme 63 | 64 | 68 | 69 | 70 | {COPYRIGHT.EMAIL} 71 | 72 | 102 | 103 | 104 | https://raw.githubusercontent.com/{GITHUB.ORG.ORIGINAL}/{GITHUB.APP.ORIGINAL}/main/screenshots/en/light-and-dark.png 105 | 106 | 107 |
108 | -------------------------------------------------------------------------------- /template/data/APP.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Type=Application 4 | Name={APP.NAME} 5 | GenericName={APP.GENERIC_NAME} 6 | Comment={APP.COMMENT} 7 | Categories={APP.CATEGORIES} 8 | Exec=com.github.{GITHUB.ORG}.{GITHUB.APP} 9 | Icon=com.github.{GITHUB.ORG}.{GITHUB.APP} 10 | Terminal=false 11 | Keywords={APP.KEYWORDS} 12 | X-GNOME-UsesNotifications=true 13 | -------------------------------------------------------------------------------- /template/data/gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | -------------------------------------------------------------------------------- /template/data/gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "Normal" 11 | The saved state of the window. 12 | The saved state of the window. 13 | 14 | 15 | (-1, -1) 16 | Window position 17 | Most recent window position (x, y) 18 | 19 | 20 | (420, 420) 21 | Most recent window size 22 | Most recent window size (width, height) 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /template/data/meson.build: -------------------------------------------------------------------------------- 1 | install_data ( 2 | 'gschema.xml', 3 | install_dir: get_option('datadir') / 'glib-2.0' / 'schemas', 4 | rename: meson.project_name() + '.gschema.xml' 5 | ) 6 | -------------------------------------------------------------------------------- /template/meson.build: -------------------------------------------------------------------------------- 1 | project( 2 | 'com.github.{GITHUB.ORG}.{GITHUB.APP}', 3 | 'vala', 4 | 'c', 5 | version: '1.0.0' 6 | ) 7 | 8 | i18n = import('i18n') 9 | gnome = import('gnome') 10 | 11 | add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), language: 'c') 12 | 13 | conf_data = configuration_data() 14 | conf_data.set_quoted('PROJECT_NAME', meson.project_name()) 15 | conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name()) 16 | conf_data.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) 17 | conf_data.set_quoted('VERSION', meson.project_version()) 18 | config_header = configure_file( 19 | input : 'src' / 'Constants' / 'Config.vala.in', 20 | output : 'Config.vala', 21 | configuration : conf_data 22 | ) 23 | 24 | # Custom resource support. 25 | # Place custom icons, etc. in the data/ directory 26 | # and add them to data/gresource.xml. 27 | gresource = gnome.compile_resources( 28 | 'gresource', 29 | 'data' / 'gresource.xml', 30 | source_dir: 'data' 31 | ) 32 | 33 | executable( 34 | meson.project_name(), 35 | gresource, 36 | 'src' / 'Application.vala', 37 | 'src' / 'MainWindow.vala', 38 | 'src' / 'Widgets' / 'HeaderBar.vala', 39 | 'src' / 'Constants' / 'Colors.vala', 40 | config_header, 41 | dependencies: [ 42 | dependency('granite', version: '>=5.2.4'), 43 | dependency('gtk+-3.0'), 44 | dependency('libhandy-1', version: '>=0.90.0'), 45 | meson.get_compiler('vala').find_library('posix') 46 | ], 47 | install: true 48 | ) 49 | 50 | # Translate and install our .desktop file. 51 | i18n.merge_file( 52 | input: 'data' / '{GITHUB.APP}.desktop.in', 53 | output: meson.project_name() + '.desktop', 54 | po_dir: meson.source_root() / 'po', 55 | type: 'desktop', 56 | install: true, 57 | install_dir: get_option('datadir') / 'applications' 58 | ) 59 | 60 | # Translate and install our .appdata file. 61 | i18n.merge_file( 62 | input: 'data' / '{GITHUB.APP}.appdata.xml.in', 63 | output: meson.project_name() + '.appdata.xml', 64 | po_dir: meson.source_root() / 'po', 65 | install: true, 66 | install_dir: get_option('datadir') / 'metainfo' 67 | ) 68 | 69 | icon_sizes = ['16', '24', '32', '48', '64', '128'] 70 | 71 | foreach i : icon_sizes 72 | install_data( 73 | 'data' / i + '.svg', 74 | install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i / 'apps', 75 | rename: meson.project_name() + '.svg' 76 | ) 77 | install_data( 78 | 'data' / i + '.svg', 79 | install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i + '@2' / 'apps', 80 | rename: meson.project_name() + '.svg' 81 | ) 82 | endforeach 83 | 84 | # Also execute the build files from the translation 85 | # and data subdirectories. 86 | subdir('po') 87 | subdir('data') 88 | 89 | # Execute post install script to compile gsettings schemas. 90 | meson.add_install_script('meson/post_install.py') 91 | -------------------------------------------------------------------------------- /template/meson/post_install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import subprocess 5 | print(os.environ) 6 | 7 | schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas') 8 | 9 | if not os.environ.get('DESTDIR'): 10 | print('Compiling gsettings schemas…') 11 | subprocess.call(['glib-compile-schemas', schemadir]) 12 | -------------------------------------------------------------------------------- /template/po/LINGUAS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/small-tech/watson/6c7b43f9b212ea7749208f8f1dcf90472ff37902/template/po/LINGUAS -------------------------------------------------------------------------------- /template/po/POTFILES: -------------------------------------------------------------------------------- 1 | src/Application.vala 2 | src/MainWindow.vala 3 | data/{GITHUB.APP}.desktop.in 4 | data/{GITHUB.APP}.appdata.xml.in 5 | -------------------------------------------------------------------------------- /template/po/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext( 2 | meson.project_name(), 3 | args: '--directory=' + meson.source_root(), 4 | preset: 'glib' 5 | ) 6 | -------------------------------------------------------------------------------- /template/site/README.md: -------------------------------------------------------------------------------- 1 | # {APP.NAME} web site source 2 | 3 | [![{APP.NAME} logo](128.svg)](https://{GITHUB.ORG.ORIGINAL}.github.io/{GITHUB.APP.ORIGINAL}) 4 | 5 | ## [Visit the site.](https://{GITHUB.ORG.ORIGINAL}.github.io/{GITHUB.APP.ORIGINAL) 6 | 7 | ## Features: 8 | 9 | - App name 10 | - App description 11 | - Screenshots (in progressively-enhanced, accessible carousel) 12 | - Install button 13 | - Commented-out Get It On AppCenter button 14 | - Links to Help, Issues, and Funding 15 | - [A signed Flatpak repository with static deltas](https://blogs.gnome.org/alexl/2017/02/10/maintaining-a-flatpak-repository/). The Install button links to the latest stable release of Comet from this repository. 16 | 17 | __Work in progress:__ Running the `task/publish` script will publish the site to /docs so it can be used in GitHub pages. 18 | -------------------------------------------------------------------------------- /template/site/com.github.ORG.APP.flatpakref: -------------------------------------------------------------------------------- 1 | [Flatpak Ref] 2 | Name=com.github.{GITHUB.ORG}.{GITHUB.APP} 3 | Url=https://{GITHUB.ORG.ORIGINAL}.github.io/{GITHUB.APP.ORIGINAL}/repo 4 | Branch=stable 5 | Title={APP.NAME} 6 | Comment={APP.COMMENT} 7 | Description={APP.DESCRIPTION} 8 | Icon=https://raw.githubusercontent.com/{GITHUB.ORG.ORIGINAL}/{GITHUB.APP.ORIGINAL}/main/data/128.svg 9 | Homepage=https://{GITHUB.ORG.ORIGINAL}.github.io/{GITHUB.APP.ORIGINAL} 10 | IsRuntime=false 11 | RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo 12 | GPGKey={GPGKey} 13 | -------------------------------------------------------------------------------- /template/site/icons/browser-download-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 24 | 26 | 30 | 31 | -------------------------------------------------------------------------------- /template/site/icons/bug-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /template/site/icons/help-contents-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /template/site/icons/io.elementary.appcenter-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /template/site/icons/positive-feedback-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /template/site/icons/text-x-copying-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /template/site/index.css: -------------------------------------------------------------------------------- 1 | @media only screen and (max-width: 580px) { 2 | /* Remove margin between footer links on narrower viewports. */ 3 | footer li { 4 | margin-right: 0 !important; 5 | } 6 | } 7 | 8 | @media only screen and (max-width: 500px) { 9 | /* Remove padding between icon and text in footer links on narrower viewports. */ 10 | footer li > a { 11 | padding-left: 1em; 12 | } 13 | } 14 | 15 | * { 16 | box-sizing: border-box; 17 | } 18 | 19 | html { 20 | background-color: #273445; /* elementary OS Slate 700*/ 21 | min-width: 320px; 22 | min-height: 100%; 23 | position: relative; 24 | } 25 | 26 | body { 27 | max-width: 900px; 28 | margin: 0 auto; 29 | padding: 0 1.25rem; 30 | /* If we can’t have Lato, we’ll go with the system defaults. */ 31 | font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Cantarell, Ubuntu, Helvetica, Arial, sans-serif; 32 | } 33 | 34 | header { 35 | color: #fafafa; /* elementary OS Silver 100 */ 36 | display: block; 37 | text-align: center; 38 | } 39 | 40 | header p { 41 | font-size: 1.5em; 42 | width: 75%; 43 | margin-left: auto; 44 | margin-right: auto; 45 | margin-bottom: 0; 46 | margin-top: 0.25em; 47 | } 48 | 49 | .button { 50 | display: inline-block; 51 | text-decoration: none; 52 | padding: 0.25em 0.5em; 53 | padding-bottom: 0.15em; /* optical adjustment */ 54 | border: 1px solid #fafafa; /* elementary OS Silver 100 */ 55 | border-radius: 0.5em; 56 | margin-top: 0.75em; 57 | font-weight: bold; 58 | font-size: 1.5em; 59 | } 60 | 61 | .button img { 62 | height: 1.25em; 63 | vertical-align: top; 64 | margin-right: 0.25em; 65 | padding-bottom: 0.25em; 66 | } 67 | 68 | aside { 69 | font-style: italic; 70 | margin-top: 1em; 71 | font-weight: normal; 72 | display: block; 73 | } 74 | 75 | .button:nth-of-type(2) { 76 | margin-left: 0.25em; 77 | } 78 | 79 | footer { 80 | color: #fafafa; /* elementary OS Silver 100 */ 81 | font-size: 1.5em; 82 | text-align: center; 83 | margin-top: 1em; 84 | margin-bottom: 0.5em; 85 | } 86 | 87 | footer small { 88 | font-size: 0.6em; 89 | } 90 | 91 | footer li { 92 | display: inline-block; 93 | margin-right: 1em; 94 | margin-top: 0.25em; 95 | margin-bottom: 0.25em; 96 | padding: 0 0.25em; 97 | } 98 | 99 | footer li:last-of-type { 100 | margin-right: 0; 101 | } 102 | 103 | footer ul { 104 | padding-left: 0; 105 | } 106 | 107 | small { 108 | display: block; 109 | margin-bottom: 0.1em; 110 | margin-left: auto; 111 | margin-right: auto; 112 | } 113 | 114 | footer li > a { 115 | padding-left: 1.25em; 116 | background-repeat: no-repeat; 117 | background-size: 1em; 118 | text-decoration: none; 119 | } 120 | 121 | footer li:first-of-type > a{ 122 | background-image: url("icons/help-contents-symbolic.svg"); 123 | } 124 | 125 | footer li:nth-of-type(2) > a { 126 | background-image: url("icons/bug-symbolic.svg"); 127 | } 128 | 129 | footer li:nth-of-type(3) > a { 130 | background-image: url("icons/applications-graphics-symbolic.svg"); 131 | } 132 | 133 | footer li:nth-of-type(4) > a { 134 | background-image: url("icons/positive-feedback-symbolic.svg"); 135 | } 136 | 137 | #get-it { 138 | text-align: center; 139 | color: #fafafa; /* elementary OS Silver 100 */ 140 | } 141 | 142 | #license img { 143 | height: 1em; 144 | vertical-align: middle; 145 | margin-right: 0.25em; 146 | } 147 | 148 | a, a:visited { 149 | color: #fafafa; /* elementary OS Silver 100 */ 150 | text-decoration-thickness: 0.01em; 151 | 152 | } 153 | 154 | #icon { 155 | margin-top: 1em; 156 | } 157 | 158 | h1 { 159 | display: block; 160 | font-size: 5em; 161 | margin-top: 0; 162 | margin-bottom: 0; 163 | } 164 | 165 | /* 166 | CSS-only carousel styles based on techniques from 167 | https://css-tricks.com/css-only-carousel/ by Chris Coyier and 168 | https://markus.oberlehner.net/blog/super-simple-progressively-enhanced-carousel-with-css-scroll-snap/ by 169 | Markus Oberlehner. 170 | */ 171 | 172 | .carousel { 173 | position: relative; 174 | margin-left: auto; 175 | margin-right: auto; 176 | margin-bottom: 2em; 177 | } 178 | 179 | *::-webkit-scrollbar { 180 | width: 0; 181 | } 182 | 183 | *::-webkit-scrollbar-track { 184 | background: transparent; 185 | } 186 | 187 | *::-webkit-scrollbar-thumb { 188 | background: transparent; 189 | border: none; 190 | } 191 | 192 | * { 193 | -ms-overflow-style: none; 194 | } 195 | 196 | #viewport { 197 | display: flex; 198 | scroll-snap-type: x mandatory; 199 | overflow-x: scroll; 200 | scroll-behavior: smooth; 201 | align-items: stretch; 202 | scrollbar-width: none; 203 | } 204 | 205 | .screenshot { 206 | position: relative; 207 | flex-grow: 0; 208 | flex-shrink: 0; 209 | flex-basis: 100%; 210 | align-self: normal; 211 | scroll-snap-align: start; 212 | } 213 | 214 | .content img { 215 | max-height: 50vh; 216 | max-width: 100%; 217 | margin-left: auto; 218 | margin-right: auto; 219 | display: block; 220 | } 221 | 222 | nav { 223 | position: absolute; 224 | right: 0; 225 | bottom: -2em; 226 | left: 0; 227 | text-align: center; 228 | } 229 | 230 | nav a { 231 | display: inline-block; 232 | width: 1.5rem; 233 | height: 1.5rem; 234 | background-color: rgba(0,0,0,0.5); 235 | background-clip: content-box; 236 | border: 0.25rem solid transparent; 237 | border-radius: 50%; 238 | font-size: 0; 239 | transition: transform 0.1s; 240 | } 241 | 242 | nav a.selected { 243 | outline: 0.25rem solid #fafafa; /* elementary OS Silver 100 */ 244 | outline-offset: -0.75rem; 245 | } 246 | 247 | nav a.transitioning { 248 | outline: 0.25rem solid rgba(255,255,255,0.33); 249 | outline-offset: -0.75rem; 250 | } 251 | 252 | nav ol, nav li { 253 | display: inline-block; 254 | } 255 | 256 | nav ol { 257 | padding-left: 0; 258 | } 259 | 260 | #viewport::before, 261 | #viewport::after, 262 | .controls a { 263 | position: absolute; 264 | 265 | /* Center vertically (50% of container - 50% of self). */ 266 | top: 50%; 267 | transform: translateY(-50%); 268 | 269 | width: 3rem; 270 | height: 3rem; 271 | background-clip: content-box; 272 | border: 0.25rem solid transparent; 273 | border-radius: 50%; 274 | 275 | z-index: 1; 276 | background-size: 1rem 1rem; 277 | background-repeat: no-repeat; 278 | background-position: center center; 279 | color: transparent; 280 | font-size: 0; 281 | } 282 | 283 | #viewport::before, 284 | .previous { 285 | left: 0; 286 | } 287 | 288 | #viewport::after, 289 | .next { 290 | right: 0; 291 | } 292 | 293 | /* 294 | Here’s how the previous/next buttons work: 295 | 296 | The actual buttons that do the work exist in every screenshot. However, if we 297 | were to use just these, you’d see them slide by as you went from screenshot to 298 | screenshot. That’s not ideal. 299 | 300 | So, we create two identical “buttons” that we place above the viewport (that’s 301 | the #viewport::before and #viewport::after styles you’re seeing). These are placed 302 | above the actual buttons (which we set to transparent) and have their pointer 303 | events set to none so that events are passed to the actual buttons. 304 | 305 | (This is a slightly refined version of the technique in Chris’s CSS Tricks example, 306 | tweaked so that the two buttons line up exactly and slightly simplified. Thanks to 307 | Chris for the original technique, which is very clever.) 308 | */ 309 | 310 | #viewport::before, 311 | #viewport::after { 312 | box-sizing: border-box; 313 | 314 | content: ''; 315 | background-color: rgba(0,0,0,0.5);; 316 | z-index: 2; 317 | pointer-events: none; 318 | } 319 | 320 | #viewport::before { 321 | background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='0,50 80,100 80,0' fill='%23fff'/%3E%3C/svg%3E"); 322 | } 323 | 324 | #viewport::after { 325 | background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='100,50 20,100 20,0' fill='%23fff'/%3E%3C/svg%3E"); 326 | } 327 | -------------------------------------------------------------------------------- /template/site/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {APP.NAME}: {APP.DESCRIPTION} 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | {APP.NAME} logo 16 | 17 |

{APP.NAME}

18 | 19 |

{APP.DESCRIPTION}

20 |
21 | 22 | 33 | 75 | 76 |
77 | Install 78 | 79 | 82 | 85 | 86 | 87 |
88 | 89 |
90 | 95 | Made with Watson. 96 | Copyright ⓒ {COPYRIGHT.YEAR}-present {COPYRIGHT.NAME} 97 | Licensed under GNU GPLv3. 98 |
99 |
100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /template/site/index.js: -------------------------------------------------------------------------------- 1 | // 2 | // Calculate the current screenshot index based on the scroll position and viewport 3 | // width of the carousel and use it to keep the same screenshot in view if 4 | // the window is resized and also to display the currently-selected index 5 | // in the navigation. 6 | // 7 | 8 | let currentScreenshotIndex = null 9 | let transitioning = false 10 | 11 | let navigationIndicators = null 12 | 13 | function updateNavigationIndicators () { 14 | let navigationIndicatorIndex = 0 15 | navigationIndicators.forEach(navigationIndicator => { 16 | if (navigationIndicatorIndex === currentScreenshotIndex) { 17 | if (transitioning) { 18 | navigationIndicator.className = 'transitioning' 19 | } else { 20 | navigationIndicator.className = 'selected' 21 | } 22 | } else { 23 | navigationIndicator.className = '' 24 | } 25 | navigationIndicatorIndex++ 26 | }) 27 | } 28 | 29 | function navigationClickHandler (event) { 30 | const screenshot = document.querySelector(event.target.getAttribute('href')) 31 | if (!screenshot) return 32 | 33 | // Make sure page doesn’t jump vertically. 34 | event.preventDefault() 35 | screenshot.scrollIntoViewIfNeeded() 36 | 37 | navigateToScreenshotAnchor(event.target) 38 | } 39 | 40 | function navigateToScreenshotAnchor (screenshotAnchor, transition = true) { 41 | let requestedIndex 42 | 43 | requestedIndex = Number(screenshotAnchor.toString().replace(/.*?screenshot/, '')) - 1 44 | 45 | if (screenshotAnchor === '') { 46 | requestedIndex = 0 47 | transition = false 48 | } 49 | 50 | if (!transition) { 51 | transitioning = false 52 | currentScreenshotIndex = requestedIndex 53 | updateNavigationIndicators() 54 | return 55 | } 56 | 57 | if (requestedIndex !== currentScreenshotIndex) { 58 | transitioning = true 59 | currentScreenshotIndex = requestedIndex 60 | updateNavigationIndicators() 61 | } 62 | } 63 | 64 | window.addEventListener('resize', () => { 65 | // Update the scroll position so the same Screenshot stays perfectly 66 | // positioned within the carousel. 67 | const viewport = document.getElementById('viewport') 68 | viewport.scrollLeft = viewport.offsetWidth * currentScreenshotIndex 69 | }) 70 | 71 | window.addEventListener('load', () => { 72 | 73 | // Save references to the navigation indicators. 74 | navigationIndicators = document.querySelectorAll('nav ol li a') 75 | 76 | // Set the initial Screenshot based on the URL 77 | navigateToScreenshotAnchor(window.location.hash, /* transition */ false) 78 | 79 | // When a navigation indicator is clicked, we augment the default behaviour 80 | // by updating the indicators to display the requested position with a dimmed 81 | // indicator. When the transition is complete, our scroll event will pick it 82 | // up and brighten the indicator. 83 | navigationIndicators.forEach(navigationIndicator => { 84 | navigationIndicator.addEventListener('click', navigationClickHandler) 85 | }) 86 | 87 | // Also add the navigation indicator triggers to the arrow buttons. 88 | const previousButtons = document.querySelectorAll('.screenshot .controls .previous') 89 | const nextButtons = document.querySelectorAll('.screenshot .controls .next') 90 | 91 | previousButtons.forEach(previousButton => { 92 | previousButton.addEventListener('click', navigationClickHandler) 93 | }) 94 | 95 | nextButtons.forEach(nextButton => { 96 | nextButton.addEventListener('click', navigationClickHandler) 97 | }) 98 | 99 | document.getElementById('viewport').addEventListener('scroll', event => { 100 | const currentViewportWidth = event.target.offsetWidth 101 | const currentViewportScrollPosition = event.target.scrollLeft 102 | 103 | if (currentViewportScrollPosition % currentViewportWidth === 0) { 104 | currentScreenshotIndex = currentViewportScrollPosition / currentViewportWidth 105 | transitioning = false 106 | updateNavigationIndicators() 107 | } 108 | }) 109 | }) 110 | 111 | // Polyfill for the non-standard yet actually useful scrollIntoViewIfNeeded method. 112 | // (https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded) 113 | // Courtesy: https://gist.github.com/hsablonniere/2581101 114 | if (!Element.prototype.scrollIntoViewIfNeeded) { 115 | Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) { 116 | centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded; 117 | 118 | var parent = this.parentNode, 119 | parentComputedStyle = window.getComputedStyle(parent, null), 120 | parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width')), 121 | parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue('border-left-width')), 122 | overTop = this.offsetTop - parent.offsetTop < parent.scrollTop, 123 | overBottom = (this.offsetTop - parent.offsetTop + this.clientHeight - parentBorderTopWidth) > (parent.scrollTop + parent.clientHeight), 124 | overLeft = this.offsetLeft - parent.offsetLeft < parent.scrollLeft, 125 | overRight = (this.offsetLeft - parent.offsetLeft + this.clientWidth - parentBorderLeftWidth) > (parent.scrollLeft + parent.clientWidth), 126 | alignWithTop = overTop && !overBottom; 127 | 128 | if ((overTop || overBottom) && centerIfNeeded) { 129 | parent.scrollTop = this.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + this.clientHeight / 2; 130 | } 131 | 132 | if ((overLeft || overRight) && centerIfNeeded) { 133 | parent.scrollLeft = this.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + this.clientWidth / 2; 134 | } 135 | 136 | if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) { 137 | this.scrollIntoView(alignWithTop); 138 | } 139 | }; 140 | } 141 | -------------------------------------------------------------------------------- /template/src/Application.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-License-Identifier: GPL-3.0-or-later 3 | * SPDX-FileCopyrightText: {COPYRIGHT.YEAR} {COPYRIGHT.NAME} <{COPYRIGHT.EMAIL}> 4 | */ 5 | 6 | namespace {APP.NAMESPACE} { 7 | public GLib.Settings saved_state; 8 | 9 | public class Application : Gtk.Application { 10 | 11 | // This is information about the app that can be useful for 12 | // introspection when the app is running as a Flatpak. 13 | public static string binary_path; 14 | public static string flatpak_id; 15 | public static bool is_running_as_flatpak; 16 | 17 | public Application () { 18 | Object( 19 | application_id: "com.github.{GITHUB.ORG}.{GITHUB.APP}", 20 | flags: ApplicationFlags.FLAGS_NONE 21 | ); 22 | 23 | saved_state = new GLib.Settings ("com.github.{GITHUB.ORG}.{GITHUB.APP}.saved-state"); 24 | 25 | // Command-line options. 26 | 27 | // If your app takes command-line arguments, you can specify it 28 | // using the set_option_context_parameter_string () method. 29 | // (The option context parameter string is displayed next to the 30 | // list of options on the first line of the --help screen.) 31 | 32 | // Display the app description as the option context summary. 33 | // The option context summary is displayed above the set of options 34 | // on the --help screen. 35 | set_option_context_summary (_("{APP.DESCRIPTION}")); 36 | 37 | // Display the copyright notice as the option context description. 38 | // The option context description is displayed below the set of options 39 | // on the --help screen. 40 | set_option_context_description (_("Copyright ⓒ {COPYRIGHT.YEAR}-present {COPYRIGHT.NAME}. Licensed under GNU GPL version 3.0.")); 41 | 42 | // Add option: --version, -v 43 | add_main_option( 44 | "version", 'v', 45 | GLib.OptionFlags.NONE, 46 | GLib.OptionArg.NONE, 47 | _("Show version number and exit"), 48 | null 49 | ); 50 | 51 | // Signal: Handle local options. 52 | handle_local_options.connect((application, options) => { 53 | // Handle option: --version, -v: 54 | // 55 | // Print a minimal version string based on the GNU coding standards. 56 | // https://www.gnu.org/prep/standards/standards.html#g_t_002d_002dversion 57 | if (options.contains("version")) { 58 | print (@"{APP.NAME} $(Constants.Config.VERSION)\n"); 59 | 60 | // OK. 61 | return 0; 62 | } 63 | 64 | // Let the system handle any other command-line options. 65 | return -1; 66 | }); 67 | } 68 | 69 | construct { 70 | // Initialise localisation. 71 | GLib.Intl.setlocale (LocaleCategory.ALL, ""); 72 | GLib.Intl.bindtextdomain (Constants.Config.GETTEXT_PACKAGE, Constants.Config.LOCALEDIR); 73 | GLib.Intl.bind_textdomain_codeset (Constants.Config.GETTEXT_PACKAGE, "UTF-8"); 74 | GLib.Intl.textdomain (Constants.Config.GETTEXT_PACKAGE); 75 | } 76 | 77 | protected override void activate () { 78 | // Use person’s preferred color scheme. 79 | // See: https://docs.elementary.io/develop/apis/color-scheme 80 | use_preferred_color_scheme (); 81 | 82 | // Ensure there is only one window and show it. 83 | MainWindow window; 84 | unowned List windows = get_windows (); 85 | if (windows.length () > 0) { 86 | window = windows.last ().data as MainWindow; 87 | window.present (); 88 | } else { 89 | window = new MainWindow (this); 90 | window.show (); 91 | }; 92 | } 93 | 94 | private void use_preferred_color_scheme () { 95 | // Set color scheme of app based on person’s preference. 96 | var granite_settings = Granite.Settings.get_default (); 97 | var gtk_settings = Gtk.Settings.get_default (); 98 | gtk_settings.gtk_application_prefer_dark_theme 99 | = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK; 100 | 101 | // Listen for changes in person’s color scheme settings 102 | // and update color scheme of app accordingly. 103 | granite_settings.notify["prefers-color-scheme"].connect (() => { 104 | gtk_settings.gtk_application_prefer_dark_theme 105 | = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK; 106 | }); 107 | } 108 | 109 | public static int main (string[] commandline_arguments) { 110 | flatpak_id = Environment.get_variable ("FLATPAK_ID"); 111 | is_running_as_flatpak = flatpak_id != null; 112 | 113 | // This removes the Gtk-Message: Failed to load module "canberra-gtk-module" 114 | // that plagues every elementary OS 6 (Odin) app at the moment when 115 | // running via Flatpak. 116 | if (is_running_as_flatpak) { 117 | Log.set_writer_func (logWriterFunc); 118 | } 119 | binary_path = File.new_for_path (commandline_arguments[0]).get_path(); 120 | 121 | return new Application ().run (commandline_arguments); 122 | } 123 | 124 | // Used to remove the standard elementary OS 6 (Odin) warnings 125 | // when running as Flatpak. (See above.) 126 | private static LogWriterOutput logWriterFunc (LogLevelFlags log_level, [CCode (array_length_type = "gsize")] LogField[] fields) { 127 | return log_level == LogLevelFlags.LEVEL_MESSAGE ? LogWriterOutput.HANDLED : LogWriterOutput.UNHANDLED; 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /template/src/Constants/Colors.vala: -------------------------------------------------------------------------------- 1 | // Colors 2 | // (See https://elementary.io/brand#color). 3 | // 4 | // Note: it looks like elementary OS uses the 5 | // Material Design naming for colours but their 6 | // “weights” don’t seem to be the same, at least 7 | // based on https://material.io/design/color/the-color-system.html#tools-for-picking-colors 8 | 9 | namespace Constants.Colors { 10 | public const string STRAWBERRY_100 = "#ff8c82"; 11 | public const string STRAWBERRY_300 = "#ed5353"; 12 | public const string STRAWBERRY_500 = "#c6262e"; 13 | public const string STRAWBERRY_700 = "#a10705"; 14 | public const string STRAWBERRY_900 = "#7a0000"; 15 | 16 | public const string ORANGE_100 = "#ffc27d"; 17 | public const string ORANGE_300 = "#ffa154"; 18 | public const string ORANGE_500 = "#f37329"; 19 | public const string ORANGE_700 = "#cc3b02"; 20 | public const string ORANGE_900 = "#a62100"; 21 | 22 | public const string BANANA_100 = "#fff394"; 23 | public const string BANANA_300 = "#ffe16b"; 24 | public const string BANANA_500 = "#f9c440"; 25 | public const string BANANA_700 = "#d48e15"; 26 | public const string BANANA_900 = "#ad5f00"; 27 | 28 | public const string LIME_100 = "#d1ff82"; 29 | public const string LIME_300 = "#9bdb4d"; 30 | public const string LIME_500 = "#68b723"; 31 | public const string LIME_700 = "#3a9104"; 32 | public const string LIME_900 = "#206b00"; 33 | 34 | public const string MINT_100 = "#89ffdd"; 35 | public const string MINT_300 = "#43d6b5"; 36 | public const string MINT_500 = "#28bca3"; 37 | public const string MINT_700 = "#0e9a83"; 38 | public const string MINT_900 = "#007367"; 39 | 40 | public const string BLUEBERRY_100 = "#8cd5ff"; 41 | public const string BLUEBERRY_300 = "#64baff"; 42 | public const string BLUEBERRY_500 = "#3689e6"; 43 | public const string BLUEBERRY_700 = "#0d52bf"; 44 | public const string BLUEBERRY_900 = "#002e99"; 45 | 46 | public const string GRAPE_100 = "#e4c6fa"; 47 | public const string GRAPE_300 = "#cd9ef7"; 48 | public const string GRAPE_500 = "#a56de2"; 49 | public const string GRAPE_700 = "#7239b3"; 50 | public const string GRAPE_900 = "#452981"; 51 | 52 | public const string BUBBLEGUM_100 = "#fe9ab8"; 53 | public const string BUBBLEGUM_300 = "#f4679d"; 54 | public const string BUBBLEGUM_500 = "#de3e80"; 55 | public const string BUBBLEGUM_700 = "#bc245d"; 56 | public const string BUBBLEGUM_900 = "#910e38"; 57 | 58 | public const string COCOA_100 = "#a3907c"; 59 | public const string COCOA_300 = "#8a715e"; 60 | public const string COCOA_500 = "#715344"; 61 | public const string COCOA_700 = "#57392d"; 62 | public const string COCOA_900 = "#3d211b"; 63 | 64 | public const string SILVER_100 = "#fafafa"; 65 | public const string SILVER_300 = "#d4d4d4"; 66 | public const string SILVER_500 = "#abacae"; 67 | public const string SILVER_700 = "#7e8087"; 68 | public const string SILVER_900 = "#555761"; 69 | 70 | public const string SLATE_100 = "#95a3ab"; 71 | public const string SLATE_300 = "#667885"; 72 | public const string SLATE_500 = "#485a6c"; 73 | public const string SLATE_700 = "#273445"; 74 | public const string SLATE_900 = "#0e141f"; 75 | 76 | public const string BLACK_100 = "#666666"; 77 | public const string BLACK_300 = "#4d4d4d"; 78 | public const string BLACK_500 = "#333333"; 79 | public const string BLACK_700 = "#1a1a1a"; 80 | public const string BLACK_900 = "#000000"; 81 | } 82 | -------------------------------------------------------------------------------- /template/src/Constants/Config.vala.in: -------------------------------------------------------------------------------- 1 | // The values of the constants in this file 2 | // are populated by Meson during the build process. 3 | // 4 | // You should not need to edit this file. 5 | // 6 | // For a unified interface to other project-wide constants, 7 | // create separate Vala files in this directory under 8 | // child namespaces (e.g., Constants.Colors, etc.) 9 | // 10 | // (This will enable to you get proper syntax highlighting, etc., 11 | // which you won’t have if you add all your constants to this file. It will 12 | // also enable you to organise your constants more semantically.) 13 | 14 | namespace Constants.Config { 15 | public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@; 16 | public const string PROJECT_NAME = @PROJECT_NAME@; 17 | public const string VERSION = @VERSION@; 18 | public const string LOCALEDIR = @LOCALEDIR@; 19 | } 20 | -------------------------------------------------------------------------------- /template/src/MainWindow.vala: -------------------------------------------------------------------------------- 1 | namespace {APP.NAMESPACE} { 2 | public class MainWindow : Hdy.ApplicationWindow { 3 | public weak {APP.NAMESPACE}.Application app { get; construct; } 4 | 5 | // Widgets 6 | public {APP.NAMESPACE}.Widgets.HeaderBar toolbar; 7 | 8 | public const string ACTION_PREFIX = "win."; 9 | public const string ACTION_FULLSCREEN = "action_fullscreen"; 10 | public const string ACTION_QUIT = "action_quit"; 11 | 12 | public SimpleActionGroup actions { get; set; } 13 | public static Gee.MultiMap action_accelerators = new Gee.HashMultiMap (); 14 | 15 | public enum WindowState { 16 | NORMAL = 0, 17 | MAXIMIZED = 1, 18 | FULLSCREEN = 2 19 | } 20 | 21 | private const ActionEntry[] ACTION_ENTRIES = { 22 | { ACTION_FULLSCREEN, action_fullscreen }, 23 | { ACTION_QUIT, action_quit }, 24 | }; 25 | 26 | private static void define_action_accelerators () { 27 | // Define action accelerators (keyboard shortcuts). 28 | action_accelerators.set (ACTION_FULLSCREEN, "F11"); 29 | action_accelerators.set (ACTION_QUIT, "q"); 30 | } 31 | 32 | public MainWindow ({APP.NAMESPACE}.Application application) { 33 | Object ( 34 | // We must set the inherited application property for Hdy.ApplicationWindow 35 | // to initialise properly. However, this is not a set-type property (get; set;) 36 | // so the assignment is made after construction, which means that we cannot 37 | // reference the application during the construct method. This is why we also 38 | // declare a property called app that is construct-type (get; construct;) which 39 | // is assigned before the constructors are run. 40 | // 41 | // So use the app property when referencing the application instance from 42 | // the constructors. Anywhere else, they can be used interchangably. 43 | app: application, 44 | application: application, // DON’T use in constructors; won’t have been assigned yet. 45 | height_request: 420, 46 | width_request: 420, 47 | hide_titlebar_when_maximized: true, // FIXME: This does not seem to have an effect. Why not? 48 | icon_name: "com.github.{GITHUB.ORG}.{GITHUB.APP}" 49 | ); 50 | } 51 | 52 | // This constructor is guaranteed to be run only once during the lifetime of the application. 53 | static construct { 54 | // Initialise the Handy library. 55 | // https://gnome.pages.gitlab.gnome.org/libhandy/ 56 | // (Apps in elementary OS 6 use the Handy library extensions 57 | // instead of GTKApplicationWindow, etc., directly.) 58 | Hdy.init(); 59 | 60 | // Define acclerators (keyboard shortcuts) for actions. 61 | MainWindow.define_action_accelerators (); 62 | } 63 | 64 | // This constructor will be called every time an instance of this class is created. 65 | construct { 66 | // State preservation: save window dimensions and location on window close. 67 | // See: https://docs.elementary.io/hig/user-workflow/closing 68 | set_up_state_preservation (); 69 | 70 | // State preservation: restore window dimensions and location from last run. 71 | // See https://docs.elementary.io/hig/user-workflow/normal-launch#state 72 | restore_window_state (); 73 | 74 | // Create window layout. 75 | create_layout (); 76 | 77 | // Set up actions (with accelerators) for full screen, quit, etc. 78 | set_up_actions (); 79 | 80 | // Make all widgets (the interface) visible. 81 | show_all (); 82 | } 83 | 84 | // Layout. 85 | 86 | private void create_layout () { 87 | // Unlike GTK, in Handy, the header bar is added to the window’s content area. 88 | // See https://gnome.pages.gitlab.gnome.org/libhandy/doc/1-latest/HdyHeaderBar.html 89 | toolbar = new {APP.NAMESPACE}.Widgets.HeaderBar (); 90 | var grid = new Gtk.Grid (); 91 | grid.attach (toolbar, 0, 0); 92 | 93 | // Add other components to go under the toolbar here. 94 | 95 | add (grid); 96 | } 97 | 98 | // State preservation. 99 | 100 | private void set_up_state_preservation () { 101 | // Before the window is deleted, preserve its state. 102 | delete_event.connect (() => { 103 | preserve_window_state (); 104 | return false; 105 | }); 106 | 107 | // Quit gracefully (ensuring state is preserved) when SIGINT or SIGTERM is received 108 | // (e.g., when run from terminal and terminated using Ctrl+C). 109 | Unix.signal_add (Posix.Signal.INT, quit_gracefully, Priority.HIGH); 110 | Unix.signal_add (Posix.Signal.TERM, quit_gracefully, Priority.HIGH); 111 | } 112 | 113 | private void restore_window_state () { 114 | var rect = Gdk.Rectangle (); 115 | {APP.NAMESPACE}.saved_state.get ("window-size", "(ii)", out rect.width, out rect.height); 116 | 117 | default_width = rect.width; 118 | default_height = rect.height; 119 | 120 | var window_state = {APP.NAMESPACE}.saved_state.get_enum ("window-state"); 121 | switch (window_state) { 122 | case WindowState.MAXIMIZED: 123 | maximize (); 124 | break; 125 | case WindowState.FULLSCREEN: 126 | fullscreen (); 127 | break; 128 | default: 129 | {APP.NAMESPACE}.saved_state.get ("window-position", "(ii)", out rect.x, out rect.y); 130 | if (rect.x != -1 && rect.y != -1) { 131 | move (rect.x, rect.y); 132 | } 133 | break; 134 | } 135 | } 136 | 137 | private void preserve_window_state () { 138 | // Persist window dimensions and location. 139 | var state = get_window ().get_state (); 140 | if (Gdk.WindowState.MAXIMIZED in state) { 141 | {APP.NAMESPACE}.saved_state.set_enum ("window-state", WindowState.MAXIMIZED); 142 | } else if (Gdk.WindowState.FULLSCREEN in state) { 143 | {APP.NAMESPACE}.saved_state.set_enum ("window-state", WindowState.FULLSCREEN); 144 | } else { 145 | {APP.NAMESPACE}.saved_state.set_enum ("window-state", WindowState.NORMAL); 146 | // Save window size 147 | int width, height; 148 | get_size (out width, out height); 149 | {APP.NAMESPACE}.saved_state.set ("window-size", "(ii)", width, height); 150 | } 151 | 152 | int x, y; 153 | get_position (out x, out y); 154 | {APP.NAMESPACE}.saved_state.set ("window-position", "(ii)", x, y); 155 | } 156 | 157 | // Actions. 158 | 159 | private void set_up_actions () { 160 | // Setup actions and their accelerators. 161 | actions = new SimpleActionGroup (); 162 | actions.add_action_entries (ACTION_ENTRIES, this); 163 | insert_action_group ("win", actions); 164 | 165 | foreach (var action in action_accelerators.get_keys ()) { 166 | var accels_array = action_accelerators[action].to_array (); 167 | accels_array += null; 168 | 169 | app.set_accels_for_action (ACTION_PREFIX + action, accels_array); 170 | } 171 | } 172 | 173 | // Action handlers. 174 | 175 | private void action_fullscreen () { 176 | if (Gdk.WindowState.FULLSCREEN in get_window ().get_state ()) { 177 | unfullscreen (); 178 | } else { 179 | fullscreen (); 180 | } 181 | } 182 | 183 | private void action_quit () { 184 | preserve_window_state (); 185 | destroy (); 186 | } 187 | 188 | // Graceful shutdown. 189 | 190 | public bool quit_gracefully () { 191 | action_quit (); 192 | return false; 193 | } 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /template/src/Widgets/HeaderBar.vala: -------------------------------------------------------------------------------- 1 | namespace {APP.NAMESPACE}.Widgets { 2 | public class HeaderBar : Hdy.HeaderBar { 3 | public HeaderBar () { 4 | Object ( 5 | title: _("{APP.NAME}"), 6 | has_subtitle: false, 7 | show_close_button: true, 8 | hexpand: true 9 | ); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /template/task/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu -o pipefail 4 | 5 | # The ninja build file may be missing if the 6 | # person ran a flatpak build before running this script. 7 | # If so, reconfigure meson. 8 | if [[ ! -f build/build.ninja ]]; then 9 | meson build --prefix=/usr 10 | fi 11 | 12 | pushd build 13 | ninja 14 | popd 15 | 16 | echo '{APP.NAME} is built.' 17 | echo '' 18 | echo 'Run it with:' 19 | echo 'build/com.github.{GITHUB.ORG}.{GITHUB.APP}' 20 | -------------------------------------------------------------------------------- /template/task/install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ###################################################################### 4 | # 5 | # Intended usage for onboarding developers: 6 | # 7 | # 1. Clone this repository 8 | # 2. Run task/install 9 | # 3. Run task/run 10 | # 11 | # And you should see this project running successfully on your machine. 12 | # (If you do not, please file an issue and let us know.) 13 | # 14 | # The install task: 15 | # 16 | # - Asks to install the elementary OS development libraries 17 | # if they don’t already exist on your machine. 18 | # 19 | # - Asks to install recommended VSCodium Vala development and debugging 20 | # extensions (Vala, Meson, CodeLLDB, XML, YAML) if you have VSCodium 21 | # installed and are missing any of them. 22 | # 23 | # - Installs all required dependencies for the project to compile. 24 | # 25 | # - Configures the Meson build. 26 | # 27 | # - Builds and installs the application using Ninja. 28 | # 29 | # - Updates your system’s icon cache so the application icon displays 30 | # properly in the Applications Menu and elsewhere. 31 | # 32 | ###################################################################### 33 | 34 | set -eu -o pipefail 35 | 36 | # Ask to install the elementary OS development libraries 37 | # if they don’t already exist on your machine. 38 | 39 | elementary_sdk_status=$(/usr/bin/dpkg-query --show --showformat='${db:Status-Status}\n' 'elementary-sdk' 2> /dev/null) 40 | if [[ $elementary_sdk_status != 'installed' ]]; then 41 | install_elementary_sdk_question=$(zenity --question --text='The elementary OS development libraries are not installed.\n\nInstall them now?' --title='Watson' --width=250 --icon-name=applications-development) 42 | install_extensions=$? 43 | if [[ $install_extensions == 0 ]]; then 44 | sudo apt install elementary-sdk 45 | fi 46 | else 47 | echo '✓ elementary OS development libraries found.' 48 | fi 49 | 50 | # Ask to install recommended VSCodium Vala development and debugging 51 | # extensions (Vala, Meson, CodeLLDB, XML, YAML) if you have VSCodium 52 | # installed and are missing any of them. 53 | 54 | which_vscodium=$(which codium) 55 | vscodium_exists=$? 56 | if [[ ${vscodium_exists} == 0 ]]; then 57 | # VSCodium is installed. Are all the extensions already installed? If so, 58 | # we don’t need to bother the person with this. 59 | already_installed_extensions_count=$(codium --list-extensions | grep -E "prince781.vala|asabil.meson|vadimcn.vscode-lldb|redhat.vscode-xml|redhat.vscode-yaml" | wc -l) 60 | if [[ ${already_installed_extensions_count} != 5 ]]; then 61 | # VSCodium is installed but one or more of the extensions that would 62 | # make the person’s life easier aren’t. Ask the person if they’d 63 | # like to have Watson install them. 64 | install_extensions_question=$(zenity --question --text='Install VSCodium extensions?\n\n(This will install the Vala, Meson, CodeLLDB debugger, XML, and YAML extensions. With the extensions installed, press F5 in VSCodium to run/debug your app.)' --title='Watson' --width=250 --icon-name=extension) 65 | install_extensions=$? 66 | if [[ $install_extensions == 0 ]]; then 67 | # Vala 68 | # https://github.com/Prince781/vala-vscode 69 | codium --install-extension prince781.vala 70 | 71 | # Meson 72 | # https://github.com/asabil/vscode-meson 73 | codium --install-extension asabil.meson 74 | 75 | # CodeLLDB: a native debugger extension based on LLDB. 76 | # https://github.com/vadimcn/vscode-lldb 77 | codium --install-extension vadimcn.vscode-lldb 78 | 79 | # EditorConfig support 80 | # https://github.com/editorconfig/editorconfig-vscode 81 | codium --install-extension editorconfig.editorconfig 82 | 83 | # XML 84 | # https://github.com/redhat-developer/vscode-xml 85 | codium --install-extension redhat.vscode-xml 86 | 87 | # YAML 88 | # https://github.com/redhat-developer/vscode-yaml 89 | codium --install-extension redhat.vscode-yaml 90 | fi 91 | else 92 | echo '✓ VSCodium and all recommended extensions already installed.' 93 | fi 94 | else 95 | echo 'ℹ️ VSCodium not installed; skipping recommended extensions check.' 96 | fi 97 | 98 | # Install dependencies. 99 | 100 | # If your app has any third-party dependencies that are not included in 101 | # the elementary OS Software Development Kit (SDK) metapackage, add installation 102 | # commands for them here. 103 | # 104 | # For a list of the packages that are included in the elementary OS SDK, see 105 | # https://github.com/elementary/metapackages/blob/master/elementary-sdk-amd64 106 | # https://github.com/elementary/metapackages/blob/master/elementary-sdk-arm64 107 | # https://github.com/elementary/metapackages/blob/master/elementary-sdk-armhf 108 | 109 | 110 | 111 | # Configure build. 112 | meson build --prefix=/usr 113 | 114 | # Create translations. 115 | 116 | # (This only needs to be done on initial project generation, otherwise it 117 | # results in a dirty git repository due to timestamps if run after a clone. 118 | # The default is not to create/update translations on install.) 119 | if [[ ${1-'do-not-create-translations'} == '--create-translations' ]]; then 120 | task/update-translations --no-status 121 | echo '✓ Created translations.' 122 | fi 123 | 124 | # Run build and install assets. 125 | pushd build 126 | ninja 127 | ninja install 128 | popd 129 | 130 | # Clear icon caches. 131 | sudo update-icon-caches /usr/share/icons/* 132 | 133 | echo '{APP.NAME} is installed.' 134 | echo '' 135 | echo 'You can run it from the Applications Menu or using the task/run script.' 136 | -------------------------------------------------------------------------------- /template/task/package: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu -o pipefail 4 | 5 | flatpak-builder build com.github.{GITHUB.ORG}.{GITHUB.APP}.yml --user --install --force-clean 6 | -------------------------------------------------------------------------------- /template/task/preview-in-appcenter: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | language="en" 4 | if [[ ! -z "${1}" ]]; then 5 | language="${1}" 6 | fi 7 | 8 | echo -e "\n • Preview in AppCenter using locale ${language}" 9 | 10 | echo -e "\n • Temporarily uncommenting icon in metadata so it displays in preview." 11 | sed -i 's//com.github.{GITHUB.ORG}.{GITHUB.APP}<\/icon>/' data/{GITHUB.APP}.appdata.xml.in 12 | 13 | echo -e "\n • Building and installing app and AppCenter metadata." 14 | 15 | # Ensure an up-to-date build exists and is installed. 16 | task/install 17 | 18 | echo -e "\n • Previewing in AppCenter. When done, exit AppCenter (do not press Ctrl+C here as we need to perform clean-up)." 19 | 20 | # Preview in the elementary OS AppCenter using the requested (or default) locale. 21 | LANGUAGE="${language}" io.elementary.appcenter --load-local build/com.github.{GITHUB.ORG}.{GITHUB.APP}.appdata.xml 22 | 23 | echo -e "\n • Re-commenting out icon in metadata so Flatpak doesn’t complain." 24 | 25 | sed -i 's/com.github.{GITHUB.ORG}.{GITHUB.APP}<\/icon>//' data/{GITHUB.APP}.appdata.xml.in 26 | 27 | echo -e "\nDone!" 28 | -------------------------------------------------------------------------------- /template/task/publish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # 4 | # Ensure GPG key exists 5 | # 6 | 7 | echo -e "\nPublishing.\n" 8 | 9 | gpg_home_directory="${HOME}/.small-tech.org/watson/com.github.{GITHUB.ORG}.{GITHUB.APP}/gpg" 10 | 11 | function gpg_key_id { 12 | echo "$(gpg2 --homedir=${gpg_home_directory} --list-keys --with-colons | grep 'fpr.*' | sed 's/fpr//g' | sed 's/://g')" 13 | } 14 | 15 | # Ensure GPG keys exist. 16 | if [[ ! -d "${gpg_home_directory}/private-keys-v1.d" ]]; then 17 | # Update status. 18 | echo -e " • GPG key does not exist; creating.\n" 19 | 20 | # Ensure GPG home directory (homedir) exists. 21 | mkdir -p "${gpg_home_directory}" 22 | 23 | # Set the correct permissions for the home directory. 24 | chmod 700 "${gpg_home_directory}" 25 | 26 | # Create GPG key. 27 | gpg2 --batch --homedir="${gpg_home_directory}" --passphrase '' --quick-gen-key {COPYRIGHT.EMAIL} - - never 28 | 29 | # Get the public key, in base64, with newlines stripped 30 | # to include in our .flatpakref file. 31 | gpg_public_key_base64="$(gpg2 --homedir=${gpg_home_directory} --export $(gpg_key_id) | base64 -w 0)" 32 | 33 | # Update the .flatpakref file with the GPG public key in base64. 34 | # Notice that we’re using a caret as a custom delimeter in sed instead of the 35 | # forward slash as base64-encoded string can contain a forward slash and this would 36 | # otherwise terminate sed’s regular expression search. 37 | # 38 | # Learn more: 39 | # 40 | # • https://base64.guru/learn/base64-characters for more details. 41 | # • https://backreference.org/2010/02/20/using-different-delimiters-in-sed/ 42 | # 43 | sed --in-place "s^{GPGKey}^${gpg_public_key_base64}^" docs/com.github.aral.watson_test.flatpakref 44 | fi 45 | 46 | echo -e " • Creating Flatpak package.\n" 47 | 48 | task/package 49 | 50 | echo -e "\n • Exporting repository.\n" 51 | 52 | flatpak build-export --gpg-sign="$(gpg_key_id)" --gpg-homedir="${gpg_home_directory}" docs/repo build stable 53 | 54 | echo -e "\n • Creating static deltas.\n" 55 | 56 | flatpak build-update-repo docs/repo --gpg-sign="$(gpg_key_id)" --gpg-homedir="${gpg_home_directory}" --generate-static-deltas 57 | 58 | echo -e "\n • Done!\n" 59 | echo -e "You can find the site and your latest repository in the docs/ directory.\n" 60 | -------------------------------------------------------------------------------- /template/task/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu -o pipefail 4 | 5 | pushd build 6 | ninja 7 | popd 8 | build/com.github.{GITHUB.ORG}.{GITHUB.APP} 9 | -------------------------------------------------------------------------------- /template/task/run-package: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu -o pipefail 4 | 5 | task/package 6 | flatpak run com.github.{GITHUB.ORG}.{GITHUB.APP} 7 | -------------------------------------------------------------------------------- /template/task/take-screenshots: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ######################################################################################## 4 | # 5 | # task/screenshots 6 | # 7 | # Take localised screenshots of the app for the elementary OS AppCenter. 8 | # 9 | # This basic script simply launches your app in supported localisations (based on 10 | # your project data) and takes a single screenshot of the launch screen. 11 | # 12 | # You can extend it to take multiple screenshots, set your app state, etc. 13 | # 14 | # For an example of an advanced configuration that takes multiple screenshots and 15 | # even includes a chroma key to show context menus without sacrificing soft drop 16 | # shadows, please see the version of the script used in Comet app: 17 | # 18 | # https://github.com/small-tech/comet/blob/main/task/take-screenshots 19 | # 20 | # Copyright ⓒ 2021-present Aral Balkan, Small Technology Foundation. 21 | # Released under GNU GPL version 3.0. 22 | # 23 | ######################################################################################## 24 | 25 | # Dependencies. 26 | 27 | # Check that gnome-screenshot and ImageMagick 7 are installed and install 28 | # them if not. 29 | 30 | which_gnome_screenshot=$(which gnome-screenshot) 31 | gnome_screenshot_exists=$? 32 | if [[ ${gnome_screenshot_exists} != 0 ]]; then 33 | 34 | echo -e "\nRequired dependency gnome-screenshot does not exist. Installing…\n" 35 | 36 | # Install gnome-screenshot. 37 | sudo apt install gnome-screenshot 38 | fi 39 | 40 | which_image_magick=$(which magick) 41 | image_magick_exists=$? 42 | if [[ ${image_magick_exists} != 0 ]]; then 43 | 44 | echo -e "\nRequired dependency ImageMagick 7 does not exist. Installing…\n" 45 | 46 | # Install Image Magick. 47 | bash -lic "wget -O /tmp/magick https://download.imagemagick.org/ImageMagick/download/binaries/magick && chmod +x /tmp/magick && test \$(wget -qO- https://download.imagemagick.org/ImageMagick/download/binaries/digest.rdf | grep 'rdf:about=\"magick\".*' -A6 | sed -rn 's/.*(.*?)<\/digest:sha256>/\1/p') = \$(sha256sum /tmp/magick | sed -r 's/(.*)\s(.*)/\1/') && (sudo mv /tmp/magick /usr/local/bin/ && echo 'ImageMagick 7 successfully installed.') || (rm /tmp/magick && echo 'Installation failed. Security error: message digest verification failed for ImageMagick 7 AppImage binary.')" 48 | fi 49 | 50 | # Configuration. 51 | 52 | # Map of languges to keyboard maps (used by setxkbmap to set the keyboard map 53 | # before xdotool types in a localised string). 54 | declare -A languages_to_keyboard_layouts=( ["en"]="us(mac)" ) 55 | 56 | # Map of languages to full language codes (without the full codes, the correct dictionary 57 | # is loaded for some languages. For example, when launched with LANGUAGE=tr git commit -a, the 58 | # Turkish dictionary is not picked up. However, when launched with LANGUAGE=tr_TR.utf8 commit -a, 59 | # it is. To check what you should map the language code to here, look in /usr/share/hunspell/ and 60 | # map it to the exact name of the file that exists for the language. 61 | declare -A languages_to_full_language_codes=( ["en"]="en" ) 62 | 63 | # 64 | # Setup. 65 | # 66 | 67 | echo -e "\n• Building and installing app (will require sudo password)." 68 | 69 | # Make sure we have a current build of Comet and that the transations 70 | # are installed. 71 | task/install 72 | 73 | echo -e "• Backing up text scaling factor." 74 | 75 | # Back up the current text scaling factor so we can restore it at the end. 76 | initial_text_scaling_factor=$(gsettings get org.gnome.desktop.interface text-scaling-factor) 77 | 78 | # Get list of localisation languages from app data. 79 | languages=("en") 80 | 81 | for language_file_name in $(ls po); do 82 | # Note: the extension test is necessary in addition to the mime-type test 83 | # as .pot files are reported with the same mime-type as .po files and we 84 | # only want to process the latter. 85 | test "${language_file_name: -3}" = ".po" && test "$(file --mime-type -b po/${language_file_name})" = "text/x-po" && { 86 | languages+=("${language_file_name::2}") 87 | } 88 | done; 89 | 90 | echo -e "• Setting text scaling factor to 1." 91 | 92 | # Set the text scaling factor to ensure consistent screenshot size. 93 | gsettings set org.gnome.desktop.interface text-scaling-factor 1 94 | 95 | echo -e "\n╭────────────────────────────────────────────────────────────────────╮" 96 | echo -e "│ Taking screenshots… PLEASE DO NOT TOUCH THE SYSTEM UNTIL COMPLETE. │" 97 | echo -e "╰────────────────────────────────────────────────────────────────────╯\n" 98 | 99 | # 100 | # Take localised screenshots. 101 | # 102 | 103 | for language in ${languages[*]}; do 104 | echo -e "\n• ${language}" 105 | echo -e " ==\n" 106 | 107 | echo " • Initialising." 108 | 109 | # Ensure the directory for the language exists and is empty. 110 | # If you are going to have a lot of screenshots, you might want to change 111 | # this to use a different repository. For example, Comet app has a separate 112 | # repository at https://github.com/small-tech/comet-screenshots 113 | language_directory="screenshots/${language}" 114 | mkdir -p "${language_directory}" 115 | 116 | echo -e " • Screenshot: Basic usage (light and dark style)\n" 117 | 118 | echo -e " › Light style" 119 | 120 | echo -e " » Switching system to light colour scheme." 121 | 122 | busctl set-property org.freedesktop.Accounts /org/freedesktop/Accounts/User1000 io.elementary.pantheon.AccountsService PrefersColorScheme i 0 123 | 124 | echo -e " » Launching app." 125 | 126 | LANGUAGE="${languages_to_full_language_codes[$language]}" build/com.github.{GITHUB.ORG}.{GITHUB.APP} & 127 | sleep 1 128 | xdotool search --onlyvisible --class {GITHUB.APP} windowactivate 129 | 130 | echo -e " » Taking screenshot." 131 | 132 | gnome-screenshot --window --include-border --file "${language_directory}/light.png" 133 | sleep 1 134 | 135 | echo -e " » Quiting app." 136 | 137 | xdotool key Ctrl+q 138 | sleep 1 139 | 140 | echo -e " › Done." 141 | 142 | echo -e " › Dark style" 143 | 144 | echo -e " » Switching system to dark colour scheme." 145 | 146 | busctl set-property org.freedesktop.Accounts /org/freedesktop/Accounts/User1000 io.elementary.pantheon.AccountsService PrefersColorScheme i 1 147 | 148 | echo -e " » Launching app." 149 | 150 | LANGUAGE="${languages_to_full_language_codes[$language]}" build/com.github.{GITHUB.ORG}.{GITHUB.APP} & 151 | sleep 1 152 | xdotool search --onlyvisible --class {GITHUB.APP} windowactivate 153 | 154 | echo -e " » Taking screenshot." 155 | 156 | gnome-screenshot --window --include-border --file "${language_directory}/dark.png" 157 | sleep 1 158 | 159 | echo -e " » Quiting app." 160 | 161 | xdotool key Ctrl+q 162 | sleep 1 163 | 164 | echo -e " › Done." 165 | 166 | echo -e " › Creating montage of the light and dark style." 167 | 168 | # Create montage of light and dark mode using a slanted split-screen effect 169 | # based on the golden mean and maintaining the original soft drop shadow. 170 | 171 | screenshot_dimensions="$(magick ${language_directory}/light.png -ping -format "%wx%h" info:)" 172 | 173 | magick \ 174 | \( "${language_directory}/light.png" +write mpr:light \) \ 175 | \( "${language_directory}/dark.png" mpr:light \( -size "${screenshot_dimensions}" xc:white -draw "stroke None fill Black path 'M %[fx:w/1.618],0 L %[fx:w-w/1.618],%[fx:h] L %[fx:w],%[fx:h] L %[fx:w],0 Z'" \) -alpha Off -composite +write mpr:montage \) \ 176 | \( mpr:montage \( mpr:light -alpha extract \) -compose CopyOpacity -composite +write "${language_directory}/light-and-dark.png" \) \ 177 | null: 178 | 179 | echo -e " › Done." 180 | done; 181 | 182 | echo -e "\n• Restoring initial text scaling factor." 183 | 184 | gsettings set org.gnome.desktop.interface text-scaling-factor "${initial_text_scaling_factor}" 185 | 186 | echo -e "\nDone!\n\nYou can find the screenshots in the screenshots folder." 187 | -------------------------------------------------------------------------------- /template/task/update-translations: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu -o pipefail 4 | 5 | pushd build 6 | ninja com.github.{GITHUB.ORG}.{GITHUB.APP}-pot 7 | ninja com.github.{GITHUB.ORG}.{GITHUB.APP}-update-po 8 | popd 9 | if [[ $# == 0 || $1 != '--no-status' ]]; then 10 | git status 11 | fi 12 | 13 | echo 'Translations updated.' 14 | echo '' 15 | echo 'Don’t forget to add and commit any' 16 | echo 'new/changed files to your repository.' 17 | -------------------------------------------------------------------------------- /watson: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ###################################################################### 4 | # 5 | # Watson version 1.0 6 | # 7 | # “It’s elementary, my dear…” 8 | # 9 | # Watson helps you set up your new elementary OS Vala app. 10 | # 11 | # For details, please see: 12 | # https://github.com/small-tech/watson 13 | # 14 | # Follows the Community Bash Style Guide. 15 | # https://github.com/azet/community_bash_style_guide 16 | # 17 | # Copyright ⓒ 2021-present Aral Balkan (https://ar.al) 18 | # Small Technology Foundation (https://small-tech.org) 19 | # 20 | # Like this? Fund us! 21 | # https://small-tech.org/fund-us 22 | # 23 | # Released under GNU GPL version 3.0. 24 | # 25 | ###################################################################### 26 | 27 | # set -eu -o pipefail 28 | 29 | function show_usage { 30 | echo 'Usage: watson [--dryrun|-d|--help|-h]' 31 | } 32 | 33 | function show_error { 34 | message=$1 35 | show_clone_instructions=$2 36 | if [[ $show_clone_instructions == '--teach-how-to-use' ]]; then 37 | show_usage 38 | fi 39 | echo '' 40 | echo -e "❌ \033[41mERROR\033[0m ${message}" 41 | if [[ $show_clone_instructions == '--teach-how-to-use' ]]; then 42 | echo '' 43 | echo 'To use Watson:' 44 | echo '' 45 | echo '1. Go to https://github.com/small-tech/watson' 46 | echo '2. Press the green “Use this template” button to create a new repository from Watson.' 47 | echo '3. Clone your new repository.' 48 | echo '4. Switch to that repository.' 49 | echo '5. Run ./watson' 50 | fi 51 | exit 52 | } 53 | 54 | function show_help { 55 | show_usage 56 | exit 57 | } 58 | 59 | function show_validation_error { 60 | show_error 'All fields are required. Please re-run Watson and try again.' 61 | } 62 | 63 | dryRun=false 64 | 65 | # Get the GitHub details from git itself. 66 | gitRemote=($(git remote -v 2> /dev/null)) 67 | 68 | # Ensure current directory is a git working copy. 69 | if [[ "$?" == "128" ]]; then 70 | show_error 'The current directory is not a git working copy.' --teach-how-to-use 71 | fi 72 | 73 | gitUrl=${gitRemote[1]} 74 | 75 | # This regular expression extracts the organisation 76 | # and app from a GitHub remote URL (works on both SSH 77 | # and HTTPS URLs.) 78 | gitUrlRegExp='.*?github\.com.(.*?)/(.*?)\.git' 79 | 80 | # Execute the regular expression. 81 | [[ $gitUrl =~ $gitUrlRegExp ]] 82 | 83 | # Get the GitHub organisation and app name from the 84 | # regular expression results. 85 | github_organisation_original="${BASH_REMATCH[1]}" 86 | github_app_original="${BASH_REMATCH[2]}" 87 | 88 | # Ensure the developer hasn’t accidentally cloned 89 | # The Watson repository instead of creating their own 90 | # using the “use this template” button on GitHub to 91 | # create their own repository based on Watson. 92 | if [[ "${github_organisation_original}" == "small-tech" && "${github_app_original}" == "watson" ]]; then 93 | show_error 'You currently have the original Watson repository cloned.' --teach-how-to-use 94 | fi 95 | 96 | function dry_run { 97 | dryRun=true 98 | echo '⧼⧼⧼⧼⧼ Dry run ⧽⧽⧽⧽⧽' 99 | echo '' 100 | echo "Carries out substitutions, presents diff, reverts changes, and exits." 101 | } 102 | 103 | # Apply flags, if any. 104 | [[ $1 == '--dry-run' || $1 == '-d' ]] && dry_run 105 | [[ $1 == '--help' || $1 == '-h' ]] && show_help 106 | 107 | current_step=0 108 | steps=('App Details (1/2)' 'App Details (2/2)' 'Copyright Details' 'Parse responses' 'Perform substitutions' 'Rename files' 'Configure, build, and install' 'Delete self' 'Commit and push changes' 'Exit') 109 | 110 | # Trap errors and handle them gracefully. 111 | # 112 | # $1: Line number of error. 113 | # $2: Exit code of command that failed. 114 | function handle_error { 115 | printf "Step %d (%s)" $(( ${current_step} + 1 )) "${steps[${current_step}]}" 116 | if (( current_step > 2 && current_step < 6 )); then 117 | printf " cancelled.\n" 118 | else 119 | printf " failed on line $1.\n" 120 | fi 121 | exit $2 122 | } 123 | trap 'handle_error ${LINENO} $? ' ERR 124 | 125 | # Constants 126 | 127 | readonly copyright_year=$(date '+%Y') 128 | 129 | # STEP 1: Get app details (1/2). 130 | 131 | app_details_pipe_separated=$(zenity --forms --height=260 --title="Watson" --text="\n App details (1/2)" --add-entry="Name:" --add-entry="Generic Name (e.g., Web Browser):" --add-entry="Summary/comment (purpose)" --add-entry="Description" --add-entry="Keywords (separated;by;semicolons)") 132 | 133 | app_details_validator='^.+\|.+\|.+\|.+\|.+$' 134 | [[ $app_details_pipe_separated =~ $app_details_validator ]] || show_validation_error 135 | 136 | current_step=$(( current_step + 1 )) 137 | 138 | # STEP 2: Get app details (2/2) – categories (multi-select list). 139 | 140 | app_categories=$(zenity --list --width=400 --height=460 --multiple --separator=";" --title="Watson" --text="\n App Details (2/2)\n\n You may select more than one.\n" --column="Category" "AudioVideo" "Audio" "Video" "Development" "Education" "Game" "Graphics" "Network" "Office" "Science" "Settings" "System" "Utility") 141 | 142 | app_categories_validator='^.+$' 143 | [[ $app_categories =~ $app_categories_validator ]] || show_validation_error 144 | 145 | current_step=$(( current_step + 1 )) 146 | 147 | # STEP 3: Get copyright details. 148 | 149 | copyright_details_pipe_separated=$(zenity --forms --width=300 --title="Watson" --text="\n Copyright Details \n\n Copyright ⓒ ${copyright_year}-present ‹Name› ‹Email›\n" --add-entry="Name" --add-entry="Email") 150 | 151 | copyright_details_validator='^.+\|.+$' 152 | [[ $copyright_details_pipe_separated =~ $copyright_details_validator ]] || show_validation_error 153 | 154 | current_step=$(( current_step + 1 )) 155 | 156 | # STEP 4: Parse responses. 157 | 158 | # Parse the pipe-separated results returned from the Zenity dialogues into bash arrays. 159 | IFS='|' read -ra app_details <<< "${app_details_pipe_separated}" 160 | IFS='|' read -ra copyright_details <<< "${copyright_details_pipe_separated}" 161 | 162 | # We replace any dashes in the desktop entry names with underscores for 163 | # compatibility with D-Bus names. See: 164 | # https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s02.html 165 | # 166 | # TODO: Also handle edge case of names that begin with numbers? (Prefix with an underscore.) 167 | github_organisation=${github_organisation_original//'-'/'_'} 168 | github_app=${github_app_original//'-'/'_'} 169 | 170 | app_name=${app_details[0]} 171 | app_generic_name=${app_details[1]} 172 | app_comment=${app_details[2]} 173 | app_description=${app_details[3]} 174 | app_keywords=${app_details[4]} 175 | 176 | # The namespace is calculated by removing spaces from the app name. 177 | # As app names are capitalised by convention, this should lead to a namespace 178 | # that conforms to Vala naming conventions on elementary OS. 179 | app_namespace=$(echo "${app_name}" | sed s/[[:space:]]//g) 180 | 181 | copyright_name=${copyright_details[0]} 182 | copyright_email=${copyright_details[1]} 183 | 184 | current_step=$(( current_step + 1 )) 185 | 186 | # STEP 5: Perform substitutions. 187 | 188 | # This is the list of files to carry out substituions in. 189 | # These files are all in the template/ directory. 190 | files=('com.github.ORG.APP.yml' 'meson.build' 'README.md' 'site/com.github.ORG.APP.flatpakref' 'site/index.html' 'site/README.md' 'src/Widgets/HeaderBar.vala' 'src/Application.vala' 'src/MainWindow.vala' 'data/APP.appdata.xml.in' 'data/APP.desktop.in' 'data/gresource.xml' 'data/gschema.xml' 'po/POTFILES' 'task/build' 'task/install' 'task/package' 'task/preview-in-appcenter' 'task/publish' 'task/run' 'task/run-package' 'task/take-screenshots' 'task/update-translations' '.github/workflows/main.yml' '.vscode/launch.json') 191 | 192 | # Switch to the template directory. 193 | pushd template 194 | 195 | # Carry out substitutions in configuration files and source code. 196 | for file in "${files[@]}"; do 197 | sed -i "s/{GITHUB.ORG.ORIGINAL}/${github_organisation_original}/g" "${file}" 198 | sed -i "s/{GITHUB.APP.ORIGINAL}/${github_app_original}/g" "${file}" 199 | sed -i "s/{GITHUB.ORG}/${github_organisation}/g" "${file}" 200 | sed -i "s/{GITHUB.APP}/${github_app}/g" "${file}" 201 | sed -i "s/{APP.NAMESPACE}/${app_namespace}/g" "${file}" 202 | sed -i "s/{APP.NAME}/${app_name}/g" "${file}" 203 | sed -i "s/{APP.GENERIC_NAME}/${app_generic_name}/g" "${file}" 204 | sed -i "s/{APP.DESCRIPTION}/${app_description}/g" "${file}" 205 | sed -i "s/{APP.COMMENT}/${app_comment}/g" "${file}" 206 | sed -i "s/{APP.CATEGORIES}/${app_categories}/g" "${file}" 207 | sed -i "s/{APP.KEYWORDS}/${app_keywords}/g" "${file}" 208 | sed -i "s/{COPYRIGHT.YEAR}/${copyright_year}/g" "${file}" 209 | sed -i "s/{COPYRIGHT.NAME}/${copyright_name}/g" "${file}" 210 | sed -i "s/{COPYRIGHT.EMAIL}/${copyright_email}/g" "${file}" 211 | done 212 | 213 | # Commit our changes (so we can always see a clean diff of the substitutions). 214 | git add --all 215 | git commit -m "Carry out template substitutions" 216 | 217 | current_step=$(( current_step + 1 )) 218 | 219 | # STEP 6: Rename files. 220 | 221 | mv com.github.ORG.APP.yml "com.github.${github_organisation}.${github_app}.yml" 222 | mv data/APP.appdata.xml.in "data/${github_app}.appdata.xml.in" 223 | mv data/APP.desktop.in "data/${github_app}.desktop.in" 224 | mv site/com.github.ORG.APP.flatpakref "site/com.github.${github_organisation}.${github_app}.flatpakref" 225 | 226 | # Switch back to the main directory, move all the files in the 227 | # template directory to the main directory (overriding Watson’s 228 | # own README, CHANGELOG, .gitignore, etc., in the process), and 229 | # delete the now-empty template directory, thereby leaving the 230 | # new app ready to be built in the next step. 231 | popd 232 | mv template/site docs 233 | mv template/* . 234 | mv template/.vscode . 235 | mv template/.github . 236 | mv template/.editorconfig . 237 | rm -r template 238 | 239 | current_step=$(( current_step + 1 )) 240 | 241 | # STEP 7: Configure, build and install. 242 | 243 | task/install --create-translations 244 | 245 | current_step=$(( current_step + 1 )) 246 | 247 | # If this is a dry run (useful when developing/testing Watson itself), 248 | # then display the git status and information on how to revert the changes, 249 | # and exit without removing watson or replacing the git repository. 250 | if ${dryRun}; then 251 | git status 252 | echo '' 253 | echo '⧼⧼⧼⧼⧼ Dry run: complete. ⧽⧽⧽⧽⧽' 254 | echo '' 255 | echo 'See changes:' 256 | echo 'git diff' 257 | echo '' 258 | echo 'Revert changes:' 259 | echo 'git reset --hard HEAD && git clean -d -f' 260 | exit 261 | fi 262 | 263 | # Step 8: Delete self (goodbye, cruel world!) 264 | 265 | rm watson 266 | 267 | current_step=$(( current_step + 1 )) 268 | 269 | # Step 9: Commit and push changes. 270 | 271 | git add --all 272 | git commit -m "Finish customising app template" 273 | git push 274 | 275 | current_step=$(( current_step + 1 )) 276 | 277 | # Step 10: Exit. 278 | 279 | # That’s it! Goodbye :) 280 | exit 0 281 | --------------------------------------------------------------------------------