gtkx README

The project's README from github.com/gtkx-org/gtkx. As one markdown file: README.md.

GTKX

GTKX

The React framework for Linux
Build native apps with React, TypeScript, and Adwaita widgets.

npm version npm downloads Node >= 26.7 License: MPL-2.0 CI status TypeScript

Homepage · Documentation · Examples · Contributing · Sponsor

Start an app

This branch develops GTKX 2.0, currently in beta. The stable release is scheduled for 1 December 2026. For the current stable release, use the 1.x documentation.

You need Linux, Node.js 26.7 or later, GTK 4.20 or later, libadwaita 1.8 or later, and the native development libraries. Follow Getting Started to install and check them before scaffolding:

npm create gtkx@beta my-app
cd my-app
npm run dev

The native addon ships prebuilt for x64 and arm64 glibc Linux. Other targets require building it from the repository with Rust.

Build with React

GTKX renders native Adwaita and GTK widgets. Use React state and events to update them, Node.js for filesystem and network access, and npm packages that do not require a browser DOM.

This is a complete entry point in a scaffolded app:

import {
  AdwApplication, AdwApplicationWindow,
  AdwHeaderBar, AdwToolbarView,
} from "@gtkx/jsx/adw";
import { GtkLabel } from "@gtkx/jsx/gtk";
import { createRoot, quit } from "@gtkx/react";

const App = () => (
  <AdwApplication>
    <AdwApplicationWindow title="My App" onCloseRequest={() => quit()}>
      <AdwToolbarView topBar={<AdwHeaderBar />}>
        <GtkLabel>Hello from GTKX</GtkLabel>
      </AdwToolbarView>
    </AdwApplicationWindow>
  </AdwApplication>
);

createRoot().render(<App />);

The CLI generates @gtkx/jsx elements and @gtkx/gi bindings from your configured native libraries. They are local to the app, not installed from npm.

Learn GTKX

The Tasks app: an Adwaita window with a sidebar of smart views and colored lists on the left, and a boxed task list on the right.

The Tasks app you build in the tutorial.

Contribute

See CONTRIBUTING.md for setup and checks, the Code of Conduct, and the security policy. Architecture and maintainer procedures are in the contributor docs.

Support GTKX

Contribute through Open Collective to help cover recurring costs. Our funding plan explains expenses, fees, and the operating reserve.

License

MPL-2.0.

gtkx (gtkx-org/gtkx)

Searching Database…

487 ·GitHub
这是什么?GTKX 是一个用 React 和 TypeScript 构建原生 Linux 桌面应用的框架,渲染的是真正的 Adwaita 和 GTK4 控件,而不是基于浏览器的界面。
这是对 UI 工具包的简单封装,还是完整的 React 渲染器?GTKX 是一个完整的 React reconciler:React 的状态和事件直接驱动原生 Adwaita/GTK 控件,文件系统和网络访问则通过 Node.js 完成,而不是浏览器 DOM。
怎么让应用跑起来?先安装所需的原生库,然后用 GTKX CLI 搭建项目骨架;它还会在应用本地生成 @gtkx/jsx 元素和 @gtkx/gi 绑定,而不是从 npm 拉取。
开始之前需要装好哪些东西?你需要 Linux、Node.js 26.7 或更高版本、GTK 4.20 或更高版本、libadwaita 1.8 或更高版本,以及原生开发库;如果目标平台不在预构建的 x64/arm64 glibc Linux 覆盖范围内,还需要用 Rust 构建原生插件。
现在能用于生产环境了吗?这个分支是 GTKX 2.0,目前处于 beta 阶段,稳定版计划于 2026 年 12 月 1 日发布,在那之前可能会有变动。
Adwaita 是什么?为什么在这里很重要?Adwaita 是 GNOME 的原生设计系统和控件集;GTKX 渲染的是真正的 Adwaita/GTK4 控件,因此应用的外观和行为都像原生 Linux 软件,而不是内嵌的浏览器视图。
GTKX 能用普通的 npm 包吗?可以,任何不依赖浏览器 DOM 的 npm 包都能用,因为 GTKX 应用运行在 Node.js 上,拥有正常的文件系统和网络访问能力。
从官方教程里能学到什么?文档完整演示了如何端到端构建一个任务(Tasks)应用,涵盖表单、导航、动画、样式、测试以及打包分发。
Creator
gtkx-org
Size
75.8 MB
Stars
487
Age
1y
Commits · 90 Days