{"id":13688441,"url":"https://github.com/srid/dioxus-desktop-template","last_synced_at":"2025-03-16T14:31:23.148Z","repository":{"id":198315472,"uuid":"700570742","full_name":"srid/dioxus-desktop-template","owner":"srid","description":"A starter template for Dioxus Desktop apps w/ Tailwind \u0026 Nix","archived":false,"fork":false,"pushed_at":"2024-08-26T21:07:23.000Z","size":249,"stargazers_count":31,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T11:01:04.855Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-10-04T21:02:02.000Z","updated_at":"2025-02-08T21:47:54.000Z","dependencies_parsed_at":"2023-11-30T19:25:30.262Z","dependency_job_id":"7b036061-c805-4650-bd50-a858a883ed28","html_url":"https://github.com/srid/dioxus-desktop-template","commit_stats":null,"previous_names":["srid/dioxus-desktop-template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdioxus-desktop-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdioxus-desktop-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdioxus-desktop-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srid%2Fdioxus-desktop-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srid","download_url":"https://codeload.github.com/srid/dioxus-desktop-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243819041,"owners_count":20352807,"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-08-02T15:01:13.876Z","updated_at":"2025-03-16T14:31:22.571Z","avatar_url":"https://github.com/srid.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# dioxus-desktop-template\n\nA starter template for [Dioxus](https://dioxuslabs.com/) Desktop apps, with Tailwind \u0026 Nix support.\n\n## Goal\n\nAct as starter project for writing new desktop apps using Dioxus, along with\n- [Nix](https://nixos.asia/en/nix-tutorial) support\n- Author's preferred tools\n  - Tailwind\n\n## Tasks\n\nThis repository is still a work-in-progress. Here's the current progress:\n\n- [ ] Nix \n  - [x] Devshell\n  - [ ] Nix package\n    - [x] Simple `nix build` / `nix run`\n    - [ ] Nix package containing macOS app bundle\n    - [x] Nix package for Linux\n- [ ] Deployment\n  - [x] macOS bundling\n  - [ ] Linux bundling\n- [x] Tailwind\n- [x] Routes \u0026 navigation\n- [x] [Application state](#application-state) (via `dioxus-signals` from 0.5)\n\nStretch goals:\n\n- macOS Application menu entries\n\n## Getting Starred\n\nIn the `nix develop` shell, run:\n\n```\njust watch \n```\n\n### Creating macOS app bundle\n\n```\njust bundle\n```\n\n### Running via Nix\n\n```\nnix run github:srid/dioxus-desktop-template\n# Or just `nix run` in the project directory\n```\n\n## Notes\n\n### Application State\n\nThis repository began in large part to understand how to manage application state in Dioxus Desktop apps, and come up with some best demonstrable practices for it.\n\n- [x] Shared read-only state\n  - In the top `App` component, use [`use_shared_state_provider`](https://dioxuslabs.com/learn/0.4/guide/state#state) to initialize the application state.\n  - In inner components, use `use_shared_state::\u003cT\u003e`, followed by a `.read()` on it, to access the current state value.\n  - The state can be changed to a new value, but not mutated. There is no per-field granularity.\n- [x] Shared state, that can be modified (from *anywhere* in the component tree)\n  - We use [dioxus-signals](https://github.com/DioxusLabs/dioxus/blob/master/packages/signals/README.md) (requires Dioxus from Git) to provide fine-grained mutation and component rerendering.\n  - In the top `App` component, use `use_context_provider(cx, AppState::new());`\n  - In inner components, use `let state: AppState = *use_context(cx).unwrap();` to access the current state value.\n  - Make individual fields of the state struct a `Signal` type\n    - The state struct should use `Signal` for its field types. Nested tree of `Signal`s is the idiom.\n  - Use `state.\u003cfield\u003e` to render a component based on a field signal\n    - Use `dioxus_signals::use_selector` to produce a derived signal\n- [x] Component re-renders when only relevant subset of the state changes\n- [x] State modification that relies on a long-running blocking task\n  - Write *async* modifier methods on the state struct, and have them update the field signals.\n  - In the UI components, use `use_future` to invoke these async methods to update the state before the component is renderer (or upon an user event).\n\n## Uses `rust-flake`\n\nThis project uses [rust-flake](https://github.com/juspay/rust-flake) to keep `flake.nix` minimal.\n\n## FAQ\n\n- Blank screen on Linux? See https://github.com/NixOS/nixpkgs/issues/32580\n```\nWEBKIT_DISABLE_COMPOSITING_MODE=1 nix run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrid%2Fdioxus-desktop-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrid%2Fdioxus-desktop-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrid%2Fdioxus-desktop-template/lists"}