{"id":50953003,"url":"https://github.com/psenger/copy-to-clipboard","last_synced_at":"2026-06-18T03:34:01.424Z","repository":{"id":353948495,"uuid":"1221383201","full_name":"psenger/copy-to-clipboard","owner":"psenger","description":"macOS Service — right-click any text file in Finder to copy its contents to the clipboard","archived":false,"fork":false,"pushed_at":"2026-04-26T11:46:37.000Z","size":169,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-18T03:33:57.249Z","etag":null,"topics":["clipboard","context-menu","finder-extension","findersync","macos","macos-utility","swift","xcode"],"latest_commit_sha":null,"homepage":null,"language":"Swift","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/psenger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-26T06:01:46.000Z","updated_at":"2026-06-08T23:17:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/psenger/copy-to-clipboard","commit_stats":null,"previous_names":["psenger/copy-to-clipboard"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/psenger/copy-to-clipboard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fcopy-to-clipboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fcopy-to-clipboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fcopy-to-clipboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fcopy-to-clipboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psenger","download_url":"https://codeload.github.com/psenger/copy-to-clipboard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psenger%2Fcopy-to-clipboard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34475375,"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-06-18T02:00:06.871Z","response_time":128,"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":["clipboard","context-menu","finder-extension","findersync","macos","macos-utility","swift","xcode"],"created_at":"2026-06-18T03:33:57.449Z","updated_at":"2026-06-18T03:34:01.391Z","avatar_url":"https://github.com/psenger.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# copy-to-clipboard\n\n\u003cimg src=\"src/Assets.xcassets/AppIcon.appiconset/icon_256x256.png\" width=\"120\" alt=\"copy-to-clipboard\"\u003e\n\n**A macOS Services helper that puts any text file's contents on the clipboard — right from Finder.**\n\n![macOS 13+](https://img.shields.io/badge/macOS-13%2B-blue)\n![Swift 6](https://img.shields.io/badge/Swift-6-orange.svg?logo=swift)\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)\n\n[Installation](#installation) • [Usage](#usage) • [How it works](#how-it-works) • [Development](#development)\n\n\u003c/div\u003e\n\n---\n\nRight-click any text file in Finder, choose **Services → Copy Contents to Clipboard**, and paste.\nNo app to open, no window to close. A Tink sound confirms the copy; a Basso sound means the\nfile was unreadable or binary.\n\nThe app handles UTF-8, UTF-16, and Windows-1252 files. It has no UI, no menu-bar icon, and no\npersistent process — macOS wakes it on demand and exits it after each invocation.\n\n## Installation\n\n```bash\nmake install\n```\n\nBuilds the Release app, copies it to `~/Applications`, and re-applies ad-hoc code signing.\nThe app registers itself with the macOS Services menu on first launch — no further setup needed.\n\n\u003e **Gatekeeper:** Ad-hoc signed apps are blocked on first open. Right-click the app in Finder,\n\u003e choose **Open**, and confirm once. macOS remembers the choice.\n\n## Usage\n\n1. Right-click any text file in Finder (`.swift`, `.py`, `.md`, `.json`, `.txt`, …)\n2. Choose **Services → Copy Contents to Clipboard**\n3. Paste anywhere\n\nThe service appears only for files whose UTI conforms to `public.text`. Binary files —\nimages, archives, executables — are silently rejected.\n\n**Encoding support**\n\n| File | How it's read |\n|---|---|\n| UTF-8 (with or without emoji) | Auto-detected |\n| UTF-16 (with BOM) | Auto-detected |\n| Windows-1252 / legacy Windows text | Explicit fallback after auto-detection fails |\n\n## How it works\n\n`copy-to-clipboard` is a launch-on-demand macOS Service. There is no persistent process.\n\n```\nFinder right-click\n  └─ macOS Services framework\n       └─ AppDelegate.copyFileContents(_:userData:error:)\n            └─ ClipboardService.copy(fileAt:)\n                 ├─ Reject non-public.text UTIs\n                 ├─ String(contentsOf:usedEncoding:)           ← UTF-8 / UTF-16\n                 ├─ String(contentsOf:encoding:.windowsCP1252) ← Windows fallback\n                 └─ NSPasteboard.general.setString(_:forType:.string)\n```\n\n**Why `setString` and not `setData`?** Writing raw file bytes to the pasteboard causes emoji\nand multi-byte Unicode to paste as garbage. Decoding the file to a Swift `String` first means\npaste targets always receive Unicode regardless of the original file encoding.\n\n## Development\n\n```bash\ngit clone https://github.com/psenger/copy-to-clipboard.git\ncd copy-to-clipboard\nmake test     # 11 tests, ~91% line coverage\nmake build    # Release build → build/Build/Products/Release/\n```\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) for the full development guide, key invariants,\nand architecture decisions.\n\n## License\n\n[MIT](./LICENSE) © 2026 Philip Senger\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**For developers who work with text files.**\n\n[Report Bug](https://github.com/psenger/copy-to-clipboard/issues) • [Request Feature](https://github.com/psenger/copy-to-clipboard/issues) • [Contributing](./CONTRIBUTING.md)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsenger%2Fcopy-to-clipboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsenger%2Fcopy-to-clipboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsenger%2Fcopy-to-clipboard/lists"}