{"id":20887943,"url":"https://github.com/canop/terminal-clipboard","last_synced_at":"2025-05-12T19:34:05.211Z","repository":{"id":43352424,"uuid":"293821735","full_name":"Canop/terminal-clipboard","owner":"Canop","description":"A cross-platform text only clipboard facade for terminal applications written in Rust","archived":false,"fork":false,"pushed_at":"2023-10-31T09:32:41.000Z","size":24,"stargazers_count":11,"open_issues_count":7,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-08T03:48:21.682Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Canop.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}},"created_at":"2020-09-08T13:39:47.000Z","updated_at":"2024-09-26T14:09:21.000Z","dependencies_parsed_at":"2022-08-12T10:40:38.706Z","dependency_job_id":"48043ddf-01dd-4610-abc6-821575945611","html_url":"https://github.com/Canop/terminal-clipboard","commit_stats":{"total_commits":12,"total_committers":3,"mean_commits":4.0,"dds":"0.16666666666666663","last_synced_commit":"3f5d6234ade704549eb034ef6ea2c6b76733ba2b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fterminal-clipboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fterminal-clipboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fterminal-clipboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fterminal-clipboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Canop","download_url":"https://codeload.github.com/Canop/terminal-clipboard/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253808635,"owners_count":21967569,"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-11-18T08:23:26.458Z","updated_at":"2025-05-12T19:34:04.875Z","avatar_url":"https://github.com/Canop.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terminal-clipboard\n\n[![CI][s3]][l3] [![MIT][s2]][l2] [![Latest Version][s1]][l1] [![Chat on Miaou][s3]][l3]\n\n[s1]: https://img.shields.io/crates/v/terminal-clipboard.svg\n[l1]: https://crates.io/crates/terminal-clipboard\n\n[s2]: https://img.shields.io/badge/license-MIT-blue.svg\n[l2]: LICENSE\n\n[s3]: https://miaou.dystroy.org/static/shields/room.svg\n[l3]: https://miaou.dystroy.org/3490?terminal-clipboard\n\n\n**terminal-clipboard** is a cross-platform clipboard library focused on strings copying and pasting for terminal applications:\n\n* it's tested on linux, windows and Android (Termux)\n* it doesn't handle other types of objects than strings\n* it doesn't handle non UTF8 strings\n\n# Usage\n\n```\nterminal_clipboard::set_string(\"test\").unwrap();\nassert_eq!(\"test\", terminal_clipboard::get_string().unwrap());\n```\n\n# Supported platforms\n\nThe implementation is currently chosen from the \"target_os\" part of the compilation target.\n\n## Android (Termux)\n\nThe current implementation will defer to Termux API facilities to access the Android clipboard, and won't work if the Termux API isn't available at runtime.\n\nIf you know of solutions to access the Android clipboard without Termux, please open an issue.\n\n## Linux\n\nIf a unix-like target is detected and the \"termux\" feature isn't enabled, terminal-clipboard uses the [x11-clipboard](https://crates.io/crates/x11-clipboard) crate.\n\nYou'll need to have `libxcb` to compile.\n\nOn Debian and Ubuntu you can install them with\n\n```\nsudo apt install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev -y\n```\n\nFedora, Centos, Red Hat\n\n```\nsudo dnf install libxcb -y\n```\n\nopenSUSE\n\n```\nsudo zypper --non-interactive install xorg-x11-util-devel libxcb-composite0 libxcb-render0 libxcb-shape0 libxcb-xfixes0\n```\n\nArch Linux\n\n```\nsudo pacman -Syu --noconfirm libxcb\n```\n\nAlpine is not supported. For alpine you have to use [`musl`](https://wiki.musl-libc.org/functional-differences-from-glibc.html) instead of `gnu` and have to provide alternative behaviour.\n\n```\n#[cfg(not(target_env = \"musl\"))]\n{\n  terminal_clipboard::set_string(answer_text).unwrap();\n  assert_eq!(*answer_text, terminal_clipboard::get_string().unwrap());\n  println!(\"Text '{answer_text}' was copied to your clipboard\")\n}\n#[cfg(target_env = \"musl\")]\n{\n  println!(\"{}\", answer_text);\n}\n```\n\n## Windows\n\nIf the compilation target is \"windows\", terminal-clipboard uses the [clipboard-win](https://crates.io/crates/clipboard-win) crate. If you're only interested in this platform, you should use this crate directly.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fterminal-clipboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanop%2Fterminal-clipboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fterminal-clipboard/lists"}