murg

Version, currently master branch1 version
  • master branchlatestJun 14, 2023

github.com/grkek/murg

An experimental GUI framework with GTK4 component generation using HTML, CSS and JavaScript

20 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  murg:
    github: grkek/murg
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
1.0.0
License
MIT
Author
Giorgi Kavrelishvili

Dependencies

Runtime Dependencies

Development Dependencies

  • ameba*github: crystal-ameba/amebadev

README

Murg

Showcase

GUI framework with GTK4 component generation using HTML, CSS and JavaScript

  • None of the components generated by Layout contain anything remotely related to a Web-Browser.

  • Compiled binary reads the custom HTML and builds the GTK components. Since it is already a pre-built release version, it is pretty fast at generating the UI components.

  • The compiler supports CSS and JavaScript compilation, which glues the components and makes the UI interactive.

  • The JavaScript engine is Duktape, it supports Babel 6.26.0 and CoreJS 2.6.11.

  • The CSS is limited to GTK4 specification.

Installation

Before you clone the shard and build it, install the GTK libraries.

Add this to your application's shard.yml:

dependencies:
  murg:
    github: grkek/murg

And run this command in your terminal:

shards install
./bin/gi-crystal

Code example

Add this to your application.cr:

require "murg"

# Disable GC for because of invalid memory access bug.
GC.disable

html = <<-HTML
  <Application applicationId="com.murg.application">
    <Window title="Untitled Window">
      <Label>Hello, World!</Label>
    </Window>
  </Application>
HTML

builder = Murg::Builder.new
# Make sure you point the path the correct way.
builder.build_from_string(html)

Compile the application.cr file.

crystal run application.cr -Dpreview_mt --error-trace

And you should have a GUI window with a "Hello, World!" text.