glippy

package module
v0.0.0-...-e7ca07f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 7 Imported by: 3

README

Glippy - Clipboard for Go

made-with-Go Maintenance PRs Welcome Go Report GoDoc

Couldn't find a go clipboard package which is both multi-platform and doesn't require additional installations. So this package is a combination of work of wonderful and talented people who created the packages mentioned in credits.

Supported Platforms:
  • OSX
  • Windows
  • Linux, Unix
Quick Start
go get github.com/f1bonacc1/glippy
package main

import (
	"fmt"
	"github.com/f1bonacc1/glippy"
)

func main(){
  // set clipboard text
  glippy.Set("Hello, Glippy")
  
  // get clipboard text
  text, err := glippy.Get()
  if err != nil{
    panic(err)
  }
  fmt.Print(text) // Output: "Hello, Glippy"
}
package main

import (
  "context"
  "fmt"
  "github.com/f1bonacc1/glippy"
)

func main(){
  // create clipboard watch channel
  ch := glippy.Watch(context.Background())
	
  for data := range ch {
    fmt.Println(data)
  }
}
Credits

https://github.com/atotto/clipboard

https://github.com/aarzilli/nucular

https://github.com/jezek/xgb

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Get

func Get() (string, error)

Get get clipboard content

func Set

func Set(text string) error

Set set clipboard content

func Watch

func Watch(ctx context.Context) <-chan string

Watch watching clipboard content

func WatchWithInterval

func WatchWithInterval(ctx context.Context, interval time.Duration) <-chan string

WatchWithInterval watching clipboard content at a specified interval

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL