GithubHelp home page GithubHelp logo

clipper's Introduction

Clipper: cross-platform clipboard library

Go Reference MIT License

Platforms supported:

  • Linux (via xclip or xsel or wl-copy/wl-paste)
  • MacOS (via pbcopy/pbpaste)
  • Windows (via the Windows clipboard API)
  • WSL (via clip.exe/powershell.exe)
  • Android Termux (via termux-clipboard-set/termux-clipboard-get)
  • Plan9 (via /dev/snarf)
  • Anything else (via a user-defined script)

Fallback methods:

  • Internal in-memory clipboard
  • File-based clipboard

Example

func main() {
    clip, err := clipper.GetClipboard(clipper.Clipboards...)
    must(err)

    // copy from stdin
    data, err := io.ReadAll(os.Stdin)
    must(err)
    err = clip.WriteAll(clipper.RegClipboard, data)
    must(err)

    // paste to stdout
    data, err := clip.ReadAll(clipper.RegClipboard)
    must(err)
    fmt.Print(string(data))
}

A CLI tool is provided as an example in cmd/clipper.

clipper's People

Contributors

zyedidia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clipper's Issues

unspecific backend detection

Hi and thanks for micro: it is an awesome tool. (only waiting for tree-sitter syntax coloration)

Now to the topic:
my clipboard was acting weird under wayland... and works flawlessly now that I removed xclip.

Problem seems clipper/micro will use xclip if installed... even though presently running under a pure (no xwayland) wayland session.

return verify(x, "xclip")

I think many clipboard bugs might® be related.

Wayland: freezes up when loading with empty clipboard

When loading an app that uses this (such as micro) on Wayland, if wl-copy and wl-paste are found in the PATH environment variable, and the clipboard is empty, the app will fail to load until something is copied.
once the app is loaded, it will freeze up whenever a clipboard action is done until the clipboard is full.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.