{"id":13503008,"url":"https://github.com/bodil/vgtk","last_synced_at":"2025-05-15T08:11:08.302Z","repository":{"id":38434799,"uuid":"164271033","full_name":"bodil/vgtk","owner":"bodil","description":"A declarative desktop UI framework for Rust built on GTK and Gtk-rs","archived":false,"fork":false,"pushed_at":"2022-02-16T12:49:01.000Z","size":24190,"stargazers_count":1057,"open_issues_count":27,"forks_count":37,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-14T14:59:40.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://bodil.lol/vgtk/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bodil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-06T03:12:19.000Z","updated_at":"2025-04-03T15:32:13.000Z","dependencies_parsed_at":"2022-07-29T22:39:33.522Z","dependency_job_id":null,"html_url":"https://github.com/bodil/vgtk","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fvgtk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fvgtk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fvgtk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fvgtk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bodil","download_url":"https://codeload.github.com/bodil/vgtk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254301432,"owners_count":22047904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:02:33.295Z","updated_at":"2025-05-15T08:11:08.256Z","avatar_url":"https://github.com/bodil.png","language":"Rust","funding_links":[],"categories":["Rust","Libraries And Frameworks"],"sub_categories":["Rust"],"readme":"# vgtk\n\nA declarative desktop UI framework for Rust built on [GTK](https://www.gtk.org/) and [Gtk-rs].\n\n## At A Glance\n\n-   A clean, functional component model inspired by the\n    [Elm architecture](https://guide.elm-lang.org/architecture/), [Redux](https://redux.js.org/) and\n    [Yew](https://github.com/yewstack/yew).\n-   A declarative DSL for composing GTK widgets inspired by [React](https://reactjs.org/) and\n    [JSX](https://reactjs.org/docs/introducing-jsx.html), using virtual \"DOM\" diffing for efficient\n    updates.\n-   Fully cross platform with a native look and feel for Linux, Windows and macOS.\n-   Built on Rust's [`Future`](https://doc.rust-lang.org/std/future/trait.Future.html)s using\n    [GLib](https://developer.gnome.org/glib/stable/)'s event loop, giving you\n    [async/await superpowers](https://rust-lang.github.io/async-book/) cleanly integrated with the\n    GTK event model.\n-   Absolutely no need for an embedded browser engine, unless you\n    [really want one](https://webkitgtk.org/).\n\n## Documentation\n\n-   [API docs (latest release)](https://docs.rs/vgtk/latest/vgtk/)\n-   [Tutorial](https://bodil.lol/vgtk/)\n\n## Show Me!\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"media/inc.png\"/\u003e\n\u003c/p\u003e\n\n```rust\nuse vgtk::{ext::*, gtk, run, Component, UpdateAction, VNode};\nuse vgtk::lib::{gtk::*, gio::ApplicationFlags};\n\n#[derive(Clone, Default, Debug)]\nstruct Model {\n    counter: usize,\n}\n\n#[derive(Clone, Debug)]\nenum Message {\n   Inc,\n   Exit,\n}\n\nimpl Component for Model {\n   type Message = Message;\n   type Properties = ();\n\n   fn update(\u0026mut self, message: Message) -\u003e UpdateAction\u003cSelf\u003e {\n       match message {\n           Message::Inc =\u003e {\n               self.counter += 1;\n               UpdateAction::Render\n           }\n           Message::Exit =\u003e {\n               vgtk::quit();\n               UpdateAction::None\n           }\n       }\n   }\n\n   fn view(\u0026self) -\u003e VNode\u003cModel\u003e {\n       gtk! {\n           \u003cApplication::new_unwrap(None, ApplicationFlags::empty())\u003e\n               \u003cWindow border_width=20 on destroy=|_| Message::Exit\u003e\n                   \u003cHeaderBar title=\"inc!\" show_close_button=true /\u003e\n                   \u003cBox spacing=10 halign=Align::Center\u003e\n                       \u003cLabel label=self.counter.to_string() /\u003e\n                       \u003cButton label=\"inc!\" image=\"add\" always_show_image=true\n                               on clicked=|_| Message::Inc /\u003e\n                   \u003c/Box\u003e\n               \u003c/Window\u003e\n           \u003c/Application\u003e\n       }\n   }\n}\n\nfn main() {\n   std::process::exit(run::\u003cModel\u003e());\n}\n```\n\n## Installation\n\nYou'll need to ensure GTK is installed and usable on your system before you can use `vgtk`. Please\nconsult the [Gtk documentation](https://www.gtk.org/docs/installations/) for detailed\ninstructions. It can be especially involved on Windows, but if you follow their instructions\ncarefully, it does eventually work.\n\n## Getting Started\n\nYou can use [`cargo generate`](https://github.com/ashleygwilliams/cargo-generate) to start a `vgtk`\nproject:\n\n```sh\ncargo generate --git https://github.com/bodil/cargo-template-vgtk\n```\n\nAlternatively, if you don't want to install `cargo generate`, you can clone the\n[template repo](https://github.com/bodil/cargo-template-vgtk) and edit the `Cargo.toml` file\nmanually to fit your project.\n\nTo run your app, enter the project folder and type `cargo run`, and marvel at the little window\nwhich eventually appears and what wonders you could fill it with.\n\n## Examples\n\nSee the [examples](examples) folder for a collection of example applications, including a complete\n[TodoMVC](examples/todomvc) implementation. To try out the TodoMVC example, clone the `vgtk` repo\nand issue `cargo run --bin todomvc` from the project root directory.\n\n## Licence\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU\nLesser General Public Licence as published by the Free Software Foundation, either version 3 of the\nLicence, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\neven the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser\nGeneral Public Licence for more details.\n\nYou should have received a copy of the GNU Lesser General Public Licence along with this program. If\nnot, see \u003chttps://www.gnu.org/licenses/\u003e.\n\n[gtk-rs]: https://gtk-rs.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbodil%2Fvgtk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbodil%2Fvgtk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbodil%2Fvgtk/lists"}