diff --git a/templates/eos/.editorconfig b/templates/elementaryos-classic/.editorconfig similarity index 100% rename from templates/eos/.editorconfig rename to templates/elementaryos-classic/.editorconfig diff --git a/templates/eos/.github/workflows/ci.yml b/templates/elementaryos-classic/.github/workflows/ci.yml similarity index 100% rename from templates/eos/.github/workflows/ci.yml rename to templates/elementaryos-classic/.github/workflows/ci.yml diff --git a/templates/eos/README.md b/templates/elementaryos-classic/README.md similarity index 100% rename from templates/eos/README.md rename to templates/elementaryos-classic/README.md diff --git a/templates/eos/com.github.${USERNAME}.${PROGRAM_NAME}.yml b/templates/elementaryos-classic/com.github.${USERNAME}.${PROGRAM_NAME}.yml similarity index 100% rename from templates/eos/com.github.${USERNAME}.${PROGRAM_NAME}.yml rename to templates/elementaryos-classic/com.github.${USERNAME}.${PROGRAM_NAME}.yml diff --git a/templates/eos/data/128.svg b/templates/elementaryos-classic/data/128.svg similarity index 100% rename from templates/eos/data/128.svg rename to templates/elementaryos-classic/data/128.svg diff --git a/templates/eos/data/16.svg b/templates/elementaryos-classic/data/16.svg similarity index 100% rename from templates/eos/data/16.svg rename to templates/elementaryos-classic/data/16.svg diff --git a/templates/eos/data/24.svg b/templates/elementaryos-classic/data/24.svg similarity index 100% rename from templates/eos/data/24.svg rename to templates/elementaryos-classic/data/24.svg diff --git a/templates/eos/data/32.svg b/templates/elementaryos-classic/data/32.svg similarity index 100% rename from templates/eos/data/32.svg rename to templates/elementaryos-classic/data/32.svg diff --git a/templates/eos/data/48.svg b/templates/elementaryos-classic/data/48.svg similarity index 100% rename from templates/eos/data/48.svg rename to templates/elementaryos-classic/data/48.svg diff --git a/templates/eos/data/64.svg b/templates/elementaryos-classic/data/64.svg similarity index 100% rename from templates/eos/data/64.svg rename to templates/elementaryos-classic/data/64.svg diff --git a/templates/eos/data/com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml b/templates/elementaryos-classic/data/com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml similarity index 100% rename from templates/eos/data/com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml rename to templates/elementaryos-classic/data/com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml diff --git a/templates/eos/data/com.github.${USERNAME}.${PROGRAM_NAME}.desktop b/templates/elementaryos-classic/data/com.github.${USERNAME}.${PROGRAM_NAME}.desktop similarity index 100% rename from templates/eos/data/com.github.${USERNAME}.${PROGRAM_NAME}.desktop rename to templates/elementaryos-classic/data/com.github.${USERNAME}.${PROGRAM_NAME}.desktop diff --git a/templates/eos/meson.build b/templates/elementaryos-classic/meson.build similarity index 100% rename from templates/eos/meson.build rename to templates/elementaryos-classic/meson.build diff --git a/templates/eos/src/Application.vala b/templates/elementaryos-classic/src/Application.vala similarity index 100% rename from templates/eos/src/Application.vala rename to templates/elementaryos-classic/src/Application.vala diff --git a/templates/eos/template.json b/templates/elementaryos-classic/template.json similarity index 100% rename from templates/eos/template.json rename to templates/elementaryos-classic/template.json diff --git a/templates/elementaryos/.editorconfig b/templates/elementaryos/.editorconfig new file mode 100644 index 0000000..677477f --- /dev/null +++ b/templates/elementaryos/.editorconfig @@ -0,0 +1,16 @@ +# EditorConfig +root = true + +# elementary defaults +[*] +charset = utf-8 +end_of_line = lf +indent_size = tab +indent_style = space +insert_final_newline = true +max_line_length = 80 +tab_width = 4 + +# Markup files +[{*.html,*.xml,*.xml.in,*.yml}] +tab_width = 2 diff --git a/templates/elementaryos/.github/workflows/ci.yml b/templates/elementaryos/.github/workflows/ci.yml new file mode 100644 index 0000000..e03efb4 --- /dev/null +++ b/templates/elementaryos/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: CI + +on: + push: + branches: [ main ] + + pull_request: + branches: [ main ] + types: + - opened + - reopened + - synchronize + +jobs: + flatpak: + name: Flatpak + runs-on: ubuntu-latest + + container: + image: ghcr.io/elementary/flatpak-platform/runtime:daily + options: --privileged + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Build + uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4 + with: + bundle: ${PROGRAM_NAME}.flatpak + manifest-path: com.github.${USERNAME}.${PROGRAM_NAME}.yml + run-tests: true + repository-name: appcenter + repository-url: https://flatpak.elementary.io/repo.flatpakrepo + cache-key: "flatpak-builder-${{ github.sha }}" + + lint: + name: Lint + runs-on: ubuntu-latest + + container: + image: valalang/lint + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Lint + run: io.elementary.vala-lint -d . diff --git a/templates/elementaryos/README.md b/templates/elementaryos/README.md new file mode 100644 index 0000000..43ad054 --- /dev/null +++ b/templates/elementaryos/README.md @@ -0,0 +1,23 @@ +# ${PROJECT_NAME} + +${PROJECT_SUMMARY} + +## Building, Testing, and Installation + +You'll need the following dependencies to build: +* libgtk-4-dev +* libgranite-7-dev +* meson +* valac + +Run `meson build` to configure the build environment and run `ninja` to build +```Bash + meson build --prefix=/usr + cd build + ninja +``` +To install, use `ninja install`, then execute with `com.${USERNAME}.${PROGRAM_NAME}` +```Bash + sudo ninja install + com.github.${USERNAME}.${PROGRAM_NAME} +``` diff --git a/templates/elementaryos/com.github.${USERNAME}.${PROGRAM_NAME}.yml b/templates/elementaryos/com.github.${USERNAME}.${PROGRAM_NAME}.yml new file mode 100644 index 0000000..2734c25 --- /dev/null +++ b/templates/elementaryos/com.github.${USERNAME}.${PROGRAM_NAME}.yml @@ -0,0 +1,34 @@ +# This is the same ID that you've used in meson.build and other files +app-id: com.github.${USERNAME}.${PROGRAM_NAME} + +# Instead of manually specifying a long list of build and runtime dependencies, +# we can use a convenient pre-made runtime and SDK. For this example, we'll be +# using the runtime and SDK provided by elementary. +runtime: io.elementary.Platform +runtime-version: "8" +sdk: io.elementary.Sdk + +# This should match the exec line in your .desktop file and usually is the same +# as your app ID +command: com.github.${USERNAME}.${PROGRAM_NAME} + +# Here we can specify the kinds of permissions our app needs to run. Since we're +# not using hardware like webcams, making sound, or reading external files, we +# only need permission to draw our app on screen using either X11 or Wayland. +finish-args: + - "--share=ipc" + - "--socket=fallback-x11" + - "--socket=wayland" + + # Needed to read prefers-color-scheme with Granite.Settings + - "--system-talk-name=org.freedesktop.Accounts" + +# This section is where you list all the source code required to build your app. +# If we had external dependencies that weren't included in our SDK, we would list +# them here. +modules: + - name: ${PROGRAM_NAME} + buildsystem: meson + sources: + - type: dir + path: . diff --git a/templates/elementaryos/data/128.svg b/templates/elementaryos/data/128.svg new file mode 100644 index 0000000..ffc11e8 --- /dev/null +++ b/templates/elementaryos/data/128.svg @@ -0,0 +1,502 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/templates/elementaryos/data/16.svg b/templates/elementaryos/data/16.svg new file mode 100644 index 0000000..ebad831 --- /dev/null +++ b/templates/elementaryos/data/16.svg @@ -0,0 +1,382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/templates/elementaryos/data/24.svg b/templates/elementaryos/data/24.svg new file mode 100644 index 0000000..b72f0c1 --- /dev/null +++ b/templates/elementaryos/data/24.svg @@ -0,0 +1,412 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/templates/elementaryos/data/32.svg b/templates/elementaryos/data/32.svg new file mode 100644 index 0000000..7ce7538 --- /dev/null +++ b/templates/elementaryos/data/32.svg @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/templates/elementaryos/data/48.svg b/templates/elementaryos/data/48.svg new file mode 100644 index 0000000..d935433 --- /dev/null +++ b/templates/elementaryos/data/48.svg @@ -0,0 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/templates/elementaryos/data/64.svg b/templates/elementaryos/data/64.svg new file mode 100644 index 0000000..6172541 --- /dev/null +++ b/templates/elementaryos/data/64.svg @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/templates/elementaryos/data/com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml b/templates/elementaryos/data/com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml new file mode 100644 index 0000000..43d7e00 --- /dev/null +++ b/templates/elementaryos/data/com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml @@ -0,0 +1,11 @@ + + + + com.github.${USERNAME}.${PROGRAM_NAME} + CC0 + ${PROJECT_NAME} + ${PROJECT_SUMMARY} + +

A quick summary of your app's main selling points and features. Just a couple sentences per paragraph is best.

+
+
diff --git a/templates/elementaryos/data/com.github.${USERNAME}.${PROGRAM_NAME}.desktop b/templates/elementaryos/data/com.github.${USERNAME}.${PROGRAM_NAME}.desktop new file mode 100644 index 0000000..30a3b7f --- /dev/null +++ b/templates/elementaryos/data/com.github.${USERNAME}.${PROGRAM_NAME}.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=${PROJECT_NAME} +GenericName=${PROJECT_NAME} App +Comment=${PROJECT_SUMMARY} +Categories=${PROJECT_CATEGORIES} +Exec=com.github.${USERNAME}.${PROGRAM_NAME} +Icon=com.github.${USERNAME}.${PROGRAM_NAME} +Terminal=false +Type=Application +Keywords=${PROJECT_KEYWORDS} diff --git a/templates/elementaryos/meson.build b/templates/elementaryos/meson.build new file mode 100644 index 0000000..9f977af --- /dev/null +++ b/templates/elementaryos/meson.build @@ -0,0 +1,43 @@ +# project name and programming language +project('com.github.${USERNAME}.${PROGRAM_NAME}', 'vala', 'c') + +# Create a new executable, list the files we want to compile, list the dependencies we need, and install +executable( + meson.project_name(), + 'src' / 'Application.vala', + dependencies: [ + dependency('gtk4'), + dependency('granite-7') + ], + install: true +) + +# Install our .desktop file so the Applications Menu will see it +install_data( + 'data' / 'com.github.${USERNAME}.${PROGRAM_NAME}.desktop', + install_dir: get_option('datadir') / 'applications', + rename: meson.project_name() + '.desktop' +) + +# Install our .appdata.xml file so AppCenter will see it +install_data( + 'data' / 'com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml', + install_dir: get_option('datadir') / 'metainfo', + rename: meson.project_name() + '.appdata.xml' +) + +# Install our icons in all the required sizes +icon_sizes = ['16', '24', '32', '48', '64', '128'] + +foreach i : icon_sizes + install_data( + 'data' / i + '.svg', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i / 'apps', + rename: meson.project_name() + '.svg' + ) + install_data( + 'data' / i + '.svg', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i + '@2' / 'apps', + rename: meson.project_name() + '.svg' + ) +endforeach diff --git a/templates/elementaryos/src/Application.vala b/templates/elementaryos/src/Application.vala new file mode 100644 index 0000000..b33ae11 --- /dev/null +++ b/templates/elementaryos/src/Application.vala @@ -0,0 +1,22 @@ +public class MyApp : Gtk.Application { + public MyApp () { + Object ( + application_id: "com.github.${USERNAME}.${PROGRAM_NAME}", + flags: ApplicationFlags.FLAGS_NONE + ); + } + + protected override void activate () { + var main_window = new Gtk.ApplicationWindow (this) { + default_height = 300, + default_width = 300, + title = "Hello World" + }; + + main_window.present (); + } + + public static int main (string[] args) { + return new MyApp ().run (args); + } +} diff --git a/templates/elementaryos/template.json b/templates/elementaryos/template.json new file mode 100644 index 0000000..85f935e --- /dev/null +++ b/templates/elementaryos/template.json @@ -0,0 +1,31 @@ +{ + "description": "a starter elementary OS app in GTK4", + "variables": { + "PROGRAM_NAME": { + "summary": "the name of the program", + "default": "/${PROJECT_NAME}/\\w+/\\u\\0/(\\w)?\\W+(\\w)?(\\w*)/\\1\\u\\2\\L\\3\\E/^\\w/\\u\\0/", + "pattern": "^[[:word:]-]+$" + }, + "PROJECT_SUMMARY": { + "summary": "a very short summary of the project", + "default": "a new app for elementary OS" + }, + "PROJECT_CATEGORIES": { + "summary": "categories (semicolon-separated)", + "pattern": "^((AudioVideo|Audio|Video|Development|Education|Game|Graphics|Network|Office|Science|Settings|System|Utility);)+$" + }, + "PROJECT_KEYWORDS": { + "summary": "keywords (semicolon-separated)", + "default": "/${PROJECT_NAME}/\\W+/;/^;+//\\w+/\\L\\0\\E/[^;]$/\\0;/", + "pattern": "^(\\w+;)+$" + } + }, + "templates": [ + "com.github.${USERNAME}.${PROGRAM_NAME}.yml", + "meson.build", + "README.md", + "data/com.github.${USERNAME}.${PROGRAM_NAME}.appdata.xml", + "data/com.github.${USERNAME}.${PROGRAM_NAME}.desktop", + "src/Application.vala" + ] +}