{"id":29151224,"url":"https://github.com/karpeleslab/goclip","last_synced_at":"2025-07-01T00:08:57.212Z","repository":{"id":134252071,"uuid":"313259144","full_name":"KarpelesLab/goclip","owner":"KarpelesLab","description":"Clipboard manipulation with Go","archived":false,"fork":false,"pushed_at":"2025-03-14T05:13:56.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-01T00:08:53.949Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/KarpelesLab.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}},"created_at":"2020-11-16T10:01:57.000Z","updated_at":"2025-03-14T04:53:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"c3ff8281-6cb2-4fa4-9c9d-e0c5fc643425","html_url":"https://github.com/KarpelesLab/goclip","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/KarpelesLab/goclip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarpelesLab%2Fgoclip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarpelesLab%2Fgoclip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarpelesLab%2Fgoclip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarpelesLab%2Fgoclip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KarpelesLab","download_url":"https://codeload.github.com/KarpelesLab/goclip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KarpelesLab%2Fgoclip/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262870877,"owners_count":23377314,"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":"2025-07-01T00:08:54.969Z","updated_at":"2025-07-01T00:08:57.117Z","avatar_url":"https://github.com/KarpelesLab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/KarpelesLab/goclip?status.svg)](https://godoc.org/github.com/KarpelesLab/goclip)\n\n# GoClip\n\n**WORK IN PROGRESS** This is not ready for use yet.\n\nManipulate clipboard from Go, using system libraries.\n\nMost clipboard implementations for Go out there rely on external programs to handle clipboard which limits what can be done quite a bit, only support text and do not have monitoring support.\n\nGoClip aims to provide a cross platform API that can be used easily without compromise on what can be done.\n\n## Target features\n\n* Easily read from or write to the clipboard\n* Support for selection clipboard on X11\n* Support for the following types of data:\n  * Unicode Text\n  * Images (returned as raw data in object with access methods to convert to `image.Image`)\n  * File lists\n* Notifications on clipboard contents updated (Monitor)\n* All operations are done using the appropriate libs (no execution of external commands)\n* On Windows acquiring ownership of the clipboard can take time. Contexts allows setting a timeout and a cancel method allowing for fine control on the process.\n\n## Code samples\n\n**Warning**: this will not work. This code is only there to illustrate the goal for this project.\n\n### Read from clipboard\n\n```go\n\tctx, _ := context.WithTimeout(context.Background(), 1*time.Second)\n\tdata, err := goclip.Paste(ctx)\n\tif err != nil {\n\t\t...\n\t}\n\ttext, err := data.ToText(ctx)\n\tif err != nil {\n\t\t...\n\t}\n\tlog.Printf(\"pasted text: %s\", text)\n```\n\nOr\n\n```go\n\tctx, _ := context.WithTimeout(context.Background(), 1*time.Second)\n\tdata, _ := goclip.Paste(ctx)\n\tswitch data.Type() { // data.Type() will return goclip.Invalid if no data\n\tcase goclip.Image:\n\t\timg, err := data.ToImage(ctx) // converts data into image\n\t}\n```\n\n### Write to clipboard\n\n```go\n\tctx, _ := context.WithTimeout(context.Background(), 1*time.Second)\n\terr := goclip.Copy(ctx, \"Hello World\") // copy text\n\terr := goclip.Copy(ctx, image.NewRGBA(...)) // copy image\n\terr := goclip.Copy(ctx, os.Open(\"...\")) // file\n```\n\n### Monitoring\n\n```go\n\tmonitor := goclip.NewMonitor()\n\tmonitor.Subscribe(func(d goclip.Data) error {\n\t\t...\n\t})\n\t...\n\t// call monitor.Poll() when gaining window focus, or on regular but slow-ish interval\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarpeleslab%2Fgoclip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarpeleslab%2Fgoclip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarpeleslab%2Fgoclip/lists"}