{"id":34250187,"url":"https://github.com/ickshonpe/bevy_mod_clipboard","last_synced_at":"2026-05-29T22:31:06.690Z","repository":{"id":324718706,"uuid":"1098225500","full_name":"ickshonpe/bevy_mod_clipboard","owner":"ickshonpe","description":null,"archived":false,"fork":false,"pushed_at":"2025-11-17T12:59:39.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-14T04:53:08.131Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ickshonpe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2025-11-17T12:22:26.000Z","updated_at":"2025-12-17T04:53:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ickshonpe/bevy_mod_clipboard","commit_stats":null,"previous_names":["ickshonpe/bevy_mod_clipboard"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ickshonpe/bevy_mod_clipboard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_mod_clipboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_mod_clipboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_mod_clipboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_mod_clipboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ickshonpe","download_url":"https://codeload.github.com/ickshonpe/bevy_mod_clipboard/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_mod_clipboard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33673627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-12-16T09:14:22.079Z","updated_at":"2026-05-29T22:31:06.684Z","avatar_url":"https://github.com/ickshonpe.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy_mod_clipboard\n\nBasic clipboard support for Bevy.\n\n## Features\n\n* Simple API using the `Clipboard` resource.\n* Asynchronous cross-platform clipboard access.\n* Supports `windows`, `linux`, `macos` and `wasm32` targets.\n* Send and fetch text to and from the clipboard to Bevy.\n\n## Usage\n\nFirst add the `ClipboardPlugin` plugin to your Bevy app:\n\n```rust\n    app.add_plugins((DefaultPlugins, ClipboardPlugin));\n```\n\nInteract with the clipboard through the `Clipboard` resource.\nTo read from the clipboard call `Clipboard::fetch_text`. \nIt returns a `ClipboardRead`:\n* On windows and Unix-like platforms, the result is ready immediately.\n* On `wasm32`, reads are asynchronous. Store the `ClipboardRead` and call `poll_result()` on subsequent frames until it returns Some.\n\nTo write to the clipboard, call `Clipboard::set_text`.\n\n## Example\n\n```rust\nuse bevy::color::palettes::css::NAVY;\nuse bevy::prelude::*;\nuse bevy_mod_clipboard::Clipboard;\nuse bevy_mod_clipboard::ClipboardPlugin;\nuse bevy_mod_clipboard::ClipboardRead;\n\nfn main() {\n    App::new()\n        .add_plugins((DefaultPlugins, ClipboardPlugin))\n        .add_systems(Startup, setup)\n        .add_systems(Update, update)\n        .run();\n}\n\nfn setup(mut commands: Commands) {\n    // UI camera\n    commands.spawn(Camera2d);\n\n    commands\n        .spawn(Node {\n            width: Val::Percent(100.),\n            height: Val::Percent(100.),\n            justify_content: JustifyContent::Center,\n            align_items: AlignItems::Center,\n            flex_direction: FlexDirection::Column,\n            row_gap: Val::Px(10.),\n            ..Default::default()\n        })\n        .with_child((\n            // Updated when the clipboard changes\n            Text::new(\"No clipboard contents fetched\"),\n            BackgroundColor(NAVY.into()),\n        ));\n}\n\n/// Fetches the current text contents of the clipboard each frame and updates\n/// the text node if it has changed.\npub fn update(\n    mut clipboard: ResMut\u003cClipboard\u003e,\n    mut maybe_read: Local\u003cOption\u003cClipboardRead\u003e\u003e,\n    mut text_query: Query\u003c\u0026mut Text\u003e,\n) {\n    // If no clipboard read is pending, fetch any text\n    if maybe_read.is_none() {\n        // `fetch_text` completes instantly on windows and unix.\n        // On wasm32 the result is fetched asynchronously, and the `ClipboardRead` needs to stored and polled\n        // on following frames until a result is available.\n        *maybe_read = Some(clipboard.fetch_text());\n    }\n\n    // Check if the clipboard read is complete and, if so, display its result.\n    if let Some(read) = maybe_read.as_mut() {\n        if let Some(contents) = read.poll_result() {\n            let clipboard_contents = contents.unwrap_or_else(|e| format!(\"{e:?}\"));\n            text_query\n                .single_mut()\n                .unwrap()\n                .set_if_neq(Text::new(clipboard_contents));\n            *maybe_read = None;\n        }\n    }\n}\n```\n\nIncluded with the crate, run with:\n```\ncargo run --example fetch_text\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickshonpe%2Fbevy_mod_clipboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fickshonpe%2Fbevy_mod_clipboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickshonpe%2Fbevy_mod_clipboard/lists"}