Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-31T05:05:42.000Z (10 months ago)
- Last Synced: 2024-05-02T04:59:39.942Z (9 months ago)
- Topics: bindings, gtk, gtk4, scala, scala-native, scala3
- Language: Scala
- Homepage:
- Size: 3.09 MB
- Stars: 27
- Watchers: 1
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gtk4 bindings for Scala 3 Native
## 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:
[![Maven Central](https://img.shields.io/maven-central/v/com.indoorvivants.gnome/gtk4_native0.4_3.svg?label=Maven%20Central)](https://search.maven.org/artifact/com.indoorvivants.gnome/gtk4_native0.4_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/)
![GtkBindingsDemo](https://user-images.githubusercontent.com/1052965/217792578-a4faa191-053b-48a7-aa2a-207709690fa1.gif)