From de205221dc7f2c4f0291b1dc1d94f6feb51631df Mon Sep 17 00:00:00 2001 From: fzzin <> Date: Thu, 9 Apr 2026 07:23:34 +0200 Subject: [PATCH] project init --- .gitignore | 2 ++ deno.json | 8 ++++++++ main.ts | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 .gitignore create mode 100644 deno.json create mode 100644 main.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef6d3fb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +deno.lock +gtk-test diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..ac77a9d --- /dev/null +++ b/deno.json @@ -0,0 +1,8 @@ +{ + "tasks": { + "dev": "deno run --watch --allow-all main.ts" + }, + "imports": { + "@sigmasd/gtk": "jsr:@sigmasd/gtk@^0.60.0" + } +} diff --git a/main.ts b/main.ts new file mode 100644 index 0000000..bf5f043 --- /dev/null +++ b/main.ts @@ -0,0 +1,37 @@ +import { + Application, + ApplicationFlags, + ApplicationWindow, + Box, + Button, + Label, + Orientation, +} from "@sigmasd/gtk/gtk4"; + +const app = new Application("com.example.HelloWorld", ApplicationFlags.NONE); + +app.onActivate(() => { + const win = new ApplicationWindow(app); + win.setTitle("Hello World"); + win.setDefaultSize(400, 300); + + const box = new Box(Orientation.VERTICAL, 12); + box.setMarginTop(24); + box.setMarginBottom(24); + box.setMarginStart(24); + box.setMarginEnd(24); + + const label = new Label("Hello, GTK! 👋"); + box.append(label); + + const button = new Button("Click Me!"); + button.onClick(() => { + label.setText("Button clicked! 🎉"); + }); + box.append(button); + + win.setChild(box); + win.present(); +}); + +app.run([]);