본문으로 건너뛰기
cccskills
무료GitHub에 공개

gnome-language-quickstart

Build-system setup for GNOME apps per language: Python/PyGObject, Rust/gtk-rs, C, Vala, JavaScript/GJS — meson files, blueprint-compiler wiring, Flatpak manifests. Use when choosing a language for a GNOME app or setting up its build.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md13.7 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Skill: Language & Library Quickstart

Pick your language. Each section is self-contained — copy the files and run.


Python + PyGObject

Uses: meson, blueprint-compiler, flatpak-pip-generator or flatpak-pypi

meson.build (root)

project('myapp', version: '0.1.0', meson_version: '>= 1.0.0')
i18n = import('i18n')
gnome = import('gnome')
python = import('python')
py = python.find_installation('python3')

dependency('gtk4', version: '>= 4.12')
dependency('libadwaita-1', version: '>= 1.4')

subdir('data')
subdir('src')
subdir('po')
gnome.post_install(glib_compile_schemas: true, gtk_update_icon_cache: true, update_desktop_database: true)

src/meson.build

pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()

blueprints = custom_target('blueprints',
  input: files('window.blp', 'preferences.blp'),
  output: '.',
  command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)

gnome.compile_resources('myapp',
  'myapp.gresource.xml',
  gresource_bundle: true,
  install: true,
  install_dir: pkgdatadir,
  dependencies: blueprints,
)

configure_file(input: 'myapp.in', output: 'myapp', configuration: conf, install: true, install_dir: get_option('bindir'))

install_data(['main.py', '__init__.py', 'window.py'],
  install_dir: pkgdatadir / 'myapp')

src/main.py

import sys, gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Adw, Gio

@Gtk.Template(resource_path='/org/example/MyApp/window.ui')
class MyWindow(Adw.ApplicationWindow):
    __gtype_name__ = 'MyWindow'
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

class MyApp(Adw.Application):
    def __init__(self):
        super().__init__(application_id='org.example.MyApp')
        self.create_action('quit', lambda *_: self.quit(), ['<primary>q'])
        self.create_action('about', self._on_about)
    def do_activate(self):
        self.win = MyWindow(application=self)
        self.win.present()
    def _on_about(self, *args):
        Adw.AboutDialog(application_name='My App', version='0.1.0', developer_name='Me', developers=['Me'], license_type=Gtk.License.GPL_3_0).present(self.win)
    def create_action(self, name, cb, shortcuts=None):
        a = Gio.SimpleAction.new(name, None)
        a.connect('activate', cb)
        self.add_action(a)
        if shortcuts: self.set_accels_for_action(f'app.{name}', shortcuts)

if __name__ == '__main__':
    MyApp().run(sys.argv)

Flatpak manifest (Python)

id: org.example.MyApp
runtime: org.gnome.Platform
runtime-version: '47'
sdk: org.gnome.Sdk
command: myapp
modules:
  - name: myapp
    buildsystem: meson
    sources:
      - type: dir
        path: .
    build-commands:
      - pip3 install --prefix=/app --no-deps .

Key packages: python3-gi, gir1.2-gtk-4.0, gir1.2-adw-1, blueprint-compiler


Rust + gtk4-rs

Uses: cargo, blueprint-compiler (build.rs), flatpak-cargo

Cargo.toml

[package]
name = "myapp"
version = "0.1.0"
edition = "2021"

[dependencies]
gtk4 = { version = "0.9", features = ["v4_12"] }
adw = { version = "0.7", features = ["v1_4"] }
gio = "0.20"
glib = "0.20"

[build-dependencies]
blueprint-compiler = "0.12"

build.rs

use blueprint_compiler::compile;
fn main() {
    compile("src/window.blp", "src/org.example.MyApp.gresource.xml");
}

src/main.rs

use gtk::prelude::*;
use adw::prelude::*;

mod imp;
mod window;

fn main() {
    let app = adw::Application::builder()
        .application_id("org.example.MyApp")
        .build();
    app.connect_activate(|app| {
        let window = window::MyWindow::new(app);
        window.present();
    });
    app.run();
}

src/window.rs

use gtk::{gio, glib};
use adw::{prelude::*, ApplicationWindow};
use gtk::subclass::prelude::*;

glib::wrapper! {
    pub struct MyWindow(ObjectSubclass<imp::MyWindow>)
        @extends gtk::Widget, gtk::Window, adw::ApplicationWindow,
        @implements gio::ActionGroup, gio::ActionMap;
}
impl MyWindow {
    pub fn new(app: &adw::Application) -> Self {
        glib::Object::builder().property("application", app).build()
    }
}
mod imp {
    use super::*;
    #[derive(Default)]
    pub struct MyWindow;
    #[glib::object_subclass]
    impl ObjectSubclass for MyWindow {
        const NAME: &'static str = "MyWindow";
        type Type = super::MyWindow;
        type ParentType = adw::ApplicationWindow;
    }
    impl ObjectImpl for MyWindow {}
    impl WidgetImpl for MyWindow {}
    impl WindowImpl for MyWindow {}
    impl ApplicationWindowImpl for MyWindow {}
}

Flatpak manifest (Rust)

{
  "id": "org.example.MyApp",
  "runtime": "org.gnome.Platform",
  "runtime-version": "47",
  "sdk": "org.gnome.Sdk",
  "sdk-extensions": ["org.freedesktop.Sdk.Extension.rust-stable"],
  "command": "myapp",
  "modules": [
    {
      "name": "myapp",
      "buildsystem": "simple",
      "build-options": {
        "append-path": "/usr/lib/sdk/rust-stable/bin",
        "env": { "CARGO_HOME": "/run/build/myapp/cargo" }
      },
      "build-commands": [
        "cargo --offline fetch --manifest-path Cargo.toml",
        "cargo --offline build --release",
        "install -D target/release/myapp /app/bin/myapp"
      ],
      "sources": [
        { "type": "dir", "path": "." },
        "generated-sources.json"
      ]
    }
  ]
}

Generate generated-sources.json with flatpak-cargo-generator.py Cargo.lock -o generated-sources.json.

Key crates: gtk4, adw, gio, glib, blueprint-compiler (build-dep)


C + GTK4 + libadwaita

Uses: meson, blueprint-compiler

meson.build (root)

project('myapp', 'c', version: '0.1.0', meson_version: '>= 1.0.0')
i18n = import('i18n')
gnome = import('gnome')

gtk_dep = dependency('gtk4', version: '>= 4.12')
adw_dep = dependency('libadwaita-1', version: '>= 1.4')

subdir('data')
subdir('src')
subdir('po')
gnome.post_install(glib_compile_schemas: true, gtk_update_icon_cache: true, update_desktop_database: true)

src/meson.build

blueprints = custom_target('blueprints',
  input: files('window.blp'),
  output: '.',
  command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)

src = gnome.compile_resources('myapp',
  'myapp.gresource.xml',
  gresource_bundle: true,
  source_dir: meson.current_build_dir(),
  dependencies: blueprints,
)

executable('myapp',
  'main.c', 'window.c', src,
  dependencies: [gtk_dep, adw_dep],
  install: true,
)

src/main.c

#include <gtk/gtk.h>
#include <adwaita.h>
#include "window.h"

static void my_app_activate(GApplication *app) {
    GtkWindow *window = GTK_WINDOW(g_object_new(MY_TYPE_WINDOW, "application", app, NULL));
    gtk_window_present(window);
}

int main(int argc, char *argv[]) {
    AdwApplication *app = adw_application_new("org.example.MyApp",
        G_APPLICATION_DEFAULT_FLAGS);
    g_signal_connect(app, "activate", G_CALLBACK(my_app_activate), NULL);
    return g_application_run(G_APPLICATION(app), argc, argv);
}

src/window.h

#pragma once
#include <gtk/gtk.h>
#include <adwaita.h>
G_BEGIN_DECLS
#define MY_TYPE_WINDOW (my_window_get_type())
G_DECLARE_FINAL_TYPE(MyWindow, my_window, MY, WINDOW, AdwApplicationWindow)
MyWindow *my_window_new(AdwApplication *app);
G_END_DECLS

src/window.c

#include "window.h"
struct _MyWindow { AdwApplicationWindow parent; };
G_DEFINE_TYPE(MyWindow, my_window, ADW_TYPE_APPLICATION_WINDOW)

static void my_window_init(MyWindow *self) {}
static void my_window_class_init(MyWindowClass *klass) {
    gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS(klass),
        "/org/example/MyApp/window.ui");
}
MyWindow *my_window_new(AdwApplication *app) {
    return g_object_new(MY_TYPE_WINDOW, "application", app, NULL);
}

Flatpak manifest (C)

id: org.example.MyApp
runtime: org.gnome.Platform
runtime-version: '47'
sdk: org.gnome.Sdk
command: myapp
modules:
  - name: myapp
    buildsystem: meson
    sources:
      - type: dir
        path: .

Key deps: gtk4-devel, libadwaita-devel, blueprint-compiler


Vala

Uses: meson, valac, blueprint-compiler

meson.build (root)

project('myapp', 'vala', 'c', version: '0.1.0', meson_version: '>= 1.0.0')
i18n = import('i18n')
gnome = import('gnome')

gtk_dep = dependency('gtk4', version: '>= 4.12')
adw_dep = dependency('libadwaita-1', version: '>= 1.4')

subdir('data')
subdir('src')
subdir('po')
gnome.post_install(glib_compile_schemas: true, gtk_update_icon_cache: true, update_desktop_database: true)

src/meson.build

blueprints = custom_target('blueprints',
  input: files('window.blp'),
  output: '.',
  command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
)

src = gnome.compile_resources('myapp',
  'myapp.gresource.xml',
  gresource_bundle: true,
  source_dir: meson.current_build_dir(),
  dependencies: blueprints,
)

executable('myapp',
  'main.vala', 'window.vala', src,
  dependencies: [gtk_dep, adw_dep],
  install: true,
)

src/main.vala

public class MyApp : Adw.Application {
    public MyApp() {
        Object(application_id: "org.example.MyApp");
    }
    protected override void activate() {
        var window = new MyWindow(this);
        window.present();
    }
    public static int main(string[] args) {
        return new MyApp().run(args);
    }
}

src/window.vala

[GtkTemplate(ui = "/org/example/MyApp/window.ui")]
public class MyWindow : Adw.ApplicationWindow {
    public MyWindow(Adw.Application app) {
        Object(application: app);
    }
}

Flatpak manifest (Vala)

id: org.example.MyApp
runtime: org.gnome.Platform
runtime-version: '47'
sdk: org.gnome.Sdk
command: myapp
modules:
  - name: myapp
    buildsystem: meson
    sources:
      - type: dir
        path: .

Key deps: vala, gtk4-devel, libadwaita-devel, blueprint-compiler


JavaScript + GJS

Uses: meson, blueprint-compiler (GJS imports GTK directly, no C compilation)

meson.build (root) — same as Python

project('myapp', version: '0.1.0', meson_version: '>= 1.0.0')
i18n = import('i18n')
gnome = import('gnome')
dependency('gtk4', version: '>= 4.12')
dependency('libadwaita-1', version: '>= 1.4')
subdir('data')
subdir('src')
subdir('po')
gnome.post_install(glib_compile_schemas: true, gtk_update_icon_cache: true, update_desktop_database: true)

src/main.js

import Adw from 'gi://Adw';
import Gtk from 'gi://Gtk';
import Gio from 'gi://Gio';

pkg.initGettext();
pkg.initFormat();

class MyWindow extends Adw.ApplicationWindow {
    static {
        Gtk.WidgetClass.install_template_from_resource(
            this.$gtype, '/org/example/MyApp/window.ui');
    }
    constructor(params = {}) {
        super(params);
        this.init_template();
    }
}

class MyApp extends Adw.Application {
    constructor() {
        super({application_id: 'org.example.MyApp'});
        this.add_action(Gio.SimpleAction.new('quit', null))
            .connect('activate', () => this.quit());
        this.set_accels_for_action('app.quit', ['<primary>q']);
    }
    vfunc_activate() {
        const window = new MyWindow({application: this});
        window.present();
    }
}

export default function main(argv) {
    return new MyApp().run(argv);
}

Flatpak manifest (GJS)

id: org.example.MyApp
runtime: org.gnome.Platform
runtime-version: '47'
sdk: org.gnome.Sdk
command: myapp
modules:
  - name: myapp
    buildsystem: meson
    sources:
      - type: dir
        path: .

Key packages: gjs, gir1.2-gtk-4.0, gir1.2-adw-1, blueprint-compiler


Quick Comparison

PythonRustCValaGJS
Build systemmesoncargo (+build.rs)mesonmesonmeson
UI formatBlueprint→UIBlueprint→UIBlueprint→UIBlueprint→UIBlueprint→UI
Template class@Gtk.Template decorator#[derive(glib::Properties)]gtk_widget_class_set_template[GtkTemplate] attributeinstall_template_from_resource
Import stylegi.require_version()use gtk::prelude::*#include <gtk/gtk.h>using Gtk;import Gtk from 'gi://Gtk';
Type safetyRuntimeCompile-timeCompile-timeCompile-timeRuntime
Startup speedMediumMediumFastFastSlow
Flatpak complexitySimpleComplex (cargo deps)SimpleSimpleSimple
Best forPrototyping, scriptingNew apps, safetyCore GNOME appsGNOME-native appsShell extensions

Common Dependencies (All Languages)

Packageflatpak build depdistro package
GTK 4gtk4-devel ≥ 4.12libgtk-4-dev
libadwaitalibadwaita-devel ≥ 1.4libadwaita-1-dev
Blueprintblueprint-compilerblueprint-compiler
AppStreamappstreamappstream
desktop-file-utilsdesktop-file-utilsdesktop-file-utils

Per-Language Gotchas

  • Rust: subclass with #[derive(glib::Properties)]; use glib::Binding for settings; compile .blp in build.rs.
  • Python: always call gi.require_version() before importing Gtk/Adw.
  • C: most core GNOME apps; best documentation coverage.
  • Vala: GNOME-native, compiles to C (Calculator).
  • GJS: used by Weather and Shell extensions.
  • Blueprint: recommended UI format; blueprint-compiler compile file.blp --output file.ui.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Add a standard AdwAboutDialog wired to app metadata, plus the AppStream metainfo file it should share data with. Use when adding an About entry, release notes, credits, or preparing app metadata.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

hanthor/gnome-gui-spec42026년 10월 11일 업데이트

Make a GTK4/libadwaita app accessible — accessible labels and roles, tooltips on icon-only buttons, keyboard navigation, contrast, and testing with Orca/Accerciser. Use when fixing a11y issues or running the accessibility category of a HIG audit.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

hanthor/gnome-gui-spec42026년 10월 11일 업데이트

Responsive GNOME layouts: AdwBreakpoint conditions, BreakpointBin, MultiLayoutView, BottomSheet, narrow/wide layout swaps. Use when making an app work on phones or narrow windows.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

hanthor/gnome-gui-spec42026년 10월 11일 업데이트

Onboarding tour with AdwCarousel and navigation dots, skippable welcome screens. Use when adding a first-run tour or feature showcase to a GNOME app.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

hanthor/gnome-gui-spec42026년 10월 11일 업데이트

Implement GNOME's 4-tier destructive-action pattern: undo toasts instead of confirmation dialogs, AdwAlertDialog for irreversible actions. Use when adding delete, remove, clear, or other destructive actions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

hanthor/gnome-gui-spec42026년 10월 11일 업데이트

Loading, empty, and error states with AdwStatusPage and AdwSpinner — placeholder icons, titles, action buttons. Use when an app view can be empty, loading, or failed.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

hanthor/gnome-gui-spec42026년 10월 11일 업데이트

hanthor의 스킬 모두 보기

이 스킬의 문제 신고