{"id":49139717,"url":"https://github.com/masak1yu/slint-ruby","last_synced_at":"2026-04-23T01:00:39.492Z","repository":{"id":351758795,"uuid":"1212387652","full_name":"masak1yu/slint-ruby","owner":"masak1yu","description":"Ruby Bindings for slint.","archived":false,"fork":false,"pushed_at":"2026-04-16T11:44:35.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-22T00:38:10.176Z","etag":null,"topics":["ruby","rust","slint"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/masak1yu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-16T10:26:49.000Z","updated_at":"2026-04-16T11:36:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/masak1yu/slint-ruby","commit_stats":null,"previous_names":["masak1yu/slint-ruby"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/masak1yu/slint-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masak1yu%2Fslint-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masak1yu%2Fslint-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masak1yu%2Fslint-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masak1yu%2Fslint-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masak1yu","download_url":"https://codeload.github.com/masak1yu/slint-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masak1yu%2Fslint-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32161325,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T17:06:48.269Z","status":"ssl_error","status_checked_at":"2026-04-22T17:06:19.037Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ruby","rust","slint"],"created_at":"2026-04-22T00:03:31.331Z","updated_at":"2026-04-23T01:00:39.467Z","avatar_url":"https://github.com/masak1yu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slint-ruby\n\nUnofficial Ruby bindings for [Slint](https://slint.dev/), a declarative GUI toolkit.\n\nBuilt with [Magnus](https://github.com/matsadler/magnus) (Rust FFI for Ruby) wrapping [`slint-interpreter`](https://docs.rs/slint-interpreter/).\n\n\u003e **Status**: Experimental. API may change.\n\n## Requirements\n\n- Ruby \u003e= 3.2\n- Rust toolchain (for compiling the native extension)\n- System dependencies for Slint's renderer:\n  - **macOS**: Xcode Command Line Tools\n  - **Linux**: `libxkbcommon-dev`, `libwayland-dev`\n\n## Installation\n\nAdd to your `Gemfile`:\n\n```ruby\ngem \"slint-ruby\", git: \"https://github.com/masak1yu/slint-ruby\"\n```\n\nThen:\n\n```sh\nbundle install\n```\n\n## Quick Start\n\n```ruby\nrequire \"slint\"\n\n# Define UI inline\nns = Slint.load_source(\u003c\u003c~SLINT)\n  export component App inherits Window {\n    in-out property \u003cstring\u003e greeting: \"Hello, Ruby!\";\n    callback clicked();\n\n    VerticalLayout {\n      Text { text: root.greeting; }\n      Button {\n        text: \"Click me\";\n        clicked =\u003e { root.clicked(); }\n      }\n    }\n  }\nSLINT\n\napp = ns::App.new\napp.on_clicked { app.greeting = \"Clicked!\" }\napp.run\n```\n\nOr load from a `.slint` file:\n\n```ruby\nns = Slint.load_file(\"ui/app.slint\")\napp = ns::App.new\napp.run\n```\n\n## API\n\n### Loading UI\n\n| Method | Description |\n|--------|-------------|\n| `Slint.load_source(source, path = \"inline.slint\", **opts)` | Compile Slint source string |\n| `Slint.load_file(path, **opts)` | Compile a `.slint` file |\n\nOptions: `style:` (e.g. `\"fluent\"`), `include_paths:` (array of search paths).\n\nBoth return a `Module` with component classes.\n\n### Components\n\n```ruby\nns = Slint.load_source(source)\napp = ns::App.new                    # create instance\napp = ns::App.new(label: \"Hi\")       # with initial property values\n\n# Properties (kebab-case in Slint becomes snake_case in Ruby)\napp.label                            # getter\napp.label = \"World\"                  # setter\n\n# Callbacks\napp.on_clicked { |arg| puts arg }    # set handler (block)\napp.on_clicked(proc { |arg| arg })   # set handler (proc)\napp.invoke_clicked(\"test\")           # invoke\n\n# Window\napp.show\napp.hide\napp.run                              # show + event loop + hide\n```\n\n### Globals\n\n```ruby\n# Access exported globals via method on the component instance\napp.AppState.current_page            # get global property\napp.AppState.current_page = \"home\"   # set global property\napp.AppState.on_navigate { |p| ... } # global callback\napp.AppState.invoke_navigate(\"about\")\n```\n\n### ListModel\n\n```ruby\nmodel = Slint::ListModel.new([1, 2, 3])\nmodel.push(4)\nmodel \u003c\u003c 5\nmodel.row_count        # =\u003e 5\nmodel.row_data(0)      # =\u003e 1.0\nmodel.set_row_data(0, 10)\nmodel.insert(1, 99)\nmodel.remove(2)\nmodel.clear\nmodel.to_a             # =\u003e [10.0, 99.0, ...]\n```\n\n### Color \u0026 Brush\n\n```ruby\ncolor = Slint::Color.new(255, 0, 0)         # RGB\ncolor = Slint::Color.rgba(255, 0, 0, 128)   # RGBA\ncolor.red    # =\u003e 255\ncolor.brighter(0.5)\ncolor.darker(0.3)\n\nbrush = Slint::Brush.from_color(color)\nbrush.color  # =\u003e Slint::Color\n```\n\n### Image\n\n```ruby\nimg = Slint::Image.load_from_path(\"icon.png\")\nimg.width    # =\u003e 64\nimg.height   # =\u003e 64\nimg.path     # =\u003e \"icon.png\"\n```\n\n### Timer\n\n```ruby\ntimer = Slint::Timer.new\ntimer.start_repeated(0.5, proc { puts \"tick\" })\ntimer.start_single_shot(1.0, proc { puts \"once\" })\ntimer.running?   # =\u003e true\ntimer.interval   # =\u003e 0.5\ntimer.stop\ntimer.restart\n```\n\n### Event Loop\n\n```ruby\nSlint.run_event_loop\nSlint.quit_event_loop\nSlint.invoke_from_event_loop(proc { ... })  # run code on the event loop thread\n```\n\n### Low-Level API\n\nThe `Slint::Compiler`, `Slint::CompilationResult`, `Slint::ComponentDefinition`, and `Slint::ComponentInstance` classes are available for advanced use:\n\n```ruby\ncompiler = Slint::Compiler.new\ncompiler.style = \"fluent\"\ncompiler.include_paths = [\"/path/to/includes\"]\n\nresult = compiler.build_from_source(source, \"app.slint\")\nraise result.diagnostics.map(\u0026:to_s).join(\"\\n\") if result.has_errors?\n\ndefinition = result.component(\"App\")\ninstance = definition.create\ninstance.set_property(\"label\", \"Hello\")\ninstance.get_property(\"label\")  # =\u003e \"Hello\"\ninstance.set_callback(\"clicked\", proc { |arg| \"got: #{arg}\" })\ninstance.invoke(\"clicked\", [\"test\"])  # =\u003e \"got: test\"\ninstance.run\n```\n\n## Development\n\n```sh\ngit clone https://github.com/masak1yu/slint-ruby\ncd slint-ruby\nbundle install\nbundle exec rake compile\nbundle exec rake test\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasak1yu%2Fslint-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasak1yu%2Fslint-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasak1yu%2Fslint-ruby/lists"}