https://github.com/indoorvivants/scala-native-gtk-bindings
Scala Native bindings To Gtk4 C API
https://github.com/indoorvivants/scala-native-gtk-bindings
bindings gtk gtk4 scala scala-native scala3
Last synced: 2 months ago
JSON representation
Scala Native bindings To Gtk4 C API
- Host: GitHub
- URL: https://github.com/indoorvivants/scala-native-gtk-bindings
- Owner: indoorvivants
- Created: 2023-02-08T20:24:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-11T15:05:55.000Z (6 months ago)
- Last Synced: 2025-03-30T17:11:30.813Z (3 months ago)
- Topics: bindings, gtk, gtk4, scala, scala-native, scala3
- Language: Scala
- Homepage:
- Size: 2.68 MB
- Stars: 33
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gtk4 bindings for Scala 3 Native
- [Gtk4 bindings for Scala 3 Native](#gtk4-bindings-for-scala-3-native)
- [Installation](#installation)
- [Usage](#usage)
- [Contributing](#contributing)## Installation
Make sure you have Gtk4 installed:
1. On MacOS, do `brew install gtk4`
2. On Debian-based Linux systems, you can do `sudo apt install libgtk-4-dev`You can check the installation by running `pkg-config --cflags gtk4` - it should succeed.
The bindings are published to Maven central, with gtk4 specifically being available at the following coordinates:
[](https://search.maven.org/artifact/com.indoorvivants.gnome/gtk4_native0.5_3/)
```
com.indoorvivants.gnome::gtk4:: // Scala CLI/Mill format
"com.indoorvivants.gnome" %%% "gtk4" % "" // SBT format
```## Usage
This repository contains a very small app you can run.
```bash
$ pkg-config --cflags gtk4 | xargs -n1 > compilationFlags
$ pkg-config --libs gtk4 | xargs -n1 > linkingFlags$ scala-cli run ./examples/src/main/scala/example.scala --native --native-compile @$PWD/compilationFlags --native-linking @$PWD/linkingFlags --dep com.indoorvivants.gnome::gtk4::0.0.4 # or change the version to latest
```Bindings generated using [sn-bindgen](https://sn-bindgen.indoorvivants.com/)

## Contributing
This section is under construction
- Regenerate raw bindings: `sbt generateRawBindings`
- Regenerate XSD schema for RNC: `sbt generateIntrospectionSchema`
This will automatically re-download the [RNC specification from GNOME](https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/main/docs/gir-1.2.rnc)