Giter Site home page Giter Site logo

gtk-webby's Introduction

GTK Webby

Webby is a proof-of-concept application that behaves like a browser, but one that renders native GTK applications rather than websites.

For additional information, check out the blog post: https://damienradtke.com/post/building-gtk-applications-like-websites/

Running

To run, first make sure you have the following installed:

  1. Rust + Cargo
  2. GTK4 development libraries
  3. Lua 5.4 development libraries

An easy way to do this is to use nix-shell, or you can use your package manager.

Once these are installed, running is simply

$ cargo run

Screenshot

Examples

Running Webby will launch a window that can be used to load GTK "web" applications. A number of examples are included with Webby that only require Rust:

$ cd examples/hello
$ cargo run

Once the example is running, you can load it in Webby by using the URL http://localhost:8000.

Tips

When running the app, use Ctrl-Shift-D to open up the GTK inspector.

Lua Scripting Reference

Webby supports Lua scripting by embedding code within a <web:script type="lua"> tag.

Global Functions

Name Description
find_widget(id: String) -> Widget Find a widget by its Builder ID and return a reference to it
fetch(url: String, response: function(err, response)) Fetch a URL asynchronously. The provided callback will be invoked with either err or response populated.
alert(message: String) Open an alert dialog with a message
submit_form(method: String, action: String, values: Table) Submit a form

Widget Methods

Name Description
connect(signal: String, after: Boolean, callback: function()) Connect a signal handler. Before invoking the callback, the global value this will be set to the widget
get_property(property_name: String) Get a property value; only works for primitive return types (like strings or booleans)
set_property(property_name: String, property_value: Any) Set a property value; only works for primitive types (like strings or booleans)
get_text() Get the text from an Entry's buffer
add_css_class(class: String) Add a CSS class
remove_css_class(class: String) Remove a CSS class
set_css_classes(classes: Array<String>) Set a list of CSS classes

gtk-webby's People

Contributors

dradtke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ag-rust

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.