diff -Nru golang-github-atotto-clipboard-0.1.1/clipboard_unix.go golang-github-atotto-clipboard-0.1.2/clipboard_unix.go --- golang-github-atotto-clipboard-0.1.1/clipboard_unix.go 2018-10-14 12:31:23.000000000 +0000 +++ golang-github-atotto-clipboard-0.1.2/clipboard_unix.go 2019-03-06 13:33:20.000000000 +0000 @@ -8,12 +8,15 @@ import ( "errors" + "os" "os/exec" ) const ( xsel = "xsel" xclip = "xclip" + wlcopy = "wl-copy" + wlpaste = "wl-paste" termuxClipboardGet = "termux-clipboard-get" termuxClipboardSet = "termux-clipboard-set" ) @@ -30,13 +33,27 @@ xclipPasteArgs = []string{xclip, "-out", "-selection", "clipboard"} xclipCopyArgs = []string{xclip, "-in", "-selection", "clipboard"} + wlpasteArgs = []string{wlpaste, "--no-newline"} + wlcopyArgs = []string{wlcopy} + termuxPasteArgs = []string{termuxClipboardGet} termuxCopyArgs = []string{termuxClipboardSet} - missingCommands = errors.New("No clipboard utilities available. Please install xsel, xclip, or Termux:API add-on for termux-clipboard-get/set.") + missingCommands = errors.New("No clipboard utilities available. Please install xsel, xclip, wl-clipboard or Termux:API add-on for termux-clipboard-get/set.") ) func init() { + if os.Getenv("WAYLAND_DISPLAY") != "" { + pasteCmdArgs = wlpasteArgs; + copyCmdArgs = wlcopyArgs; + + if _, err := exec.LookPath(wlcopy); err == nil { + if _, err := exec.LookPath(wlpaste); err == nil { + return + } + } + } + pasteCmdArgs = xclipPasteArgs copyCmdArgs = xclipCopyArgs diff -Nru golang-github-atotto-clipboard-0.1.1/cmd/gocopy/gocopy.go golang-github-atotto-clipboard-0.1.2/cmd/gocopy/gocopy.go --- golang-github-atotto-clipboard-0.1.1/cmd/gocopy/gocopy.go 2018-10-14 12:31:23.000000000 +0000 +++ golang-github-atotto-clipboard-0.1.2/cmd/gocopy/gocopy.go 2019-03-06 13:33:20.000000000 +0000 @@ -1,13 +1,17 @@ package main import ( + "flag" "io/ioutil" "os" + "time" "github.com/atotto/clipboard" ) func main() { + timeout := flag.Duration("t", 0, "Erase clipboard after timeout. Durations are specified like \"20s\" or \"2h45m\". 0 (default) means never erase.") + flag.Parse() out, err := ioutil.ReadAll(os.Stdin) if err != nil { @@ -17,4 +21,18 @@ if err := clipboard.WriteAll(string(out)); err != nil { panic(err) } + + if timeout != nil && *timeout > 0 { + <-time.After(*timeout) + text, err := clipboard.ReadAll() + if err != nil { + os.Exit(1) + } + if text == string(out) { + err = clipboard.WriteAll("") + } + } + if err != nil { + os.Exit(1) + } } diff -Nru golang-github-atotto-clipboard-0.1.1/debian/changelog golang-github-atotto-clipboard-0.1.2/debian/changelog --- golang-github-atotto-clipboard-0.1.1/debian/changelog 2018-12-20 17:19:42.000000000 +0000 +++ golang-github-atotto-clipboard-0.1.2/debian/changelog 2019-09-28 12:47:05.000000000 +0000 @@ -1,3 +1,12 @@ +golang-github-atotto-clipboard (0.1.2-1) unstable; urgency=medium + + * Team upload. + * New upstream version 0.1.2 + * Switch to debhelper-compat and use v12 + * Update Standards-Version to 4.4.0, no changes needed + + -- Dr. Tobias Quathamer Sat, 28 Sep 2019 14:47:05 +0200 + golang-github-atotto-clipboard (0.1.1-1) unstable; urgency=medium * New upstream version 0.1.1 diff -Nru golang-github-atotto-clipboard-0.1.1/debian/compat golang-github-atotto-clipboard-0.1.2/debian/compat --- golang-github-atotto-clipboard-0.1.1/debian/compat 2018-12-20 17:14:14.000000000 +0000 +++ golang-github-atotto-clipboard-0.1.2/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru golang-github-atotto-clipboard-0.1.1/debian/control golang-github-atotto-clipboard-0.1.2/debian/control --- golang-github-atotto-clipboard-0.1.1/debian/control 2018-12-20 17:19:02.000000000 +0000 +++ golang-github-atotto-clipboard-0.1.2/debian/control 2019-09-28 12:46:37.000000000 +0000 @@ -3,10 +3,10 @@ Priority: optional Maintainer: Debian Go Packaging Team Uploaders: Anthony Fok -Build-Depends: debhelper (>= 11), +Build-Depends: debhelper-compat (= 12), dh-golang, golang-any -Standards-Version: 4.2.1 +Standards-Version: 4.4.0 Homepage: https://github.com/atotto/clipboard Vcs-Browser: https://salsa.debian.org/go-team/packages/golang-github-atotto-clipboard Vcs-Git: https://salsa.debian.org/go-team/packages/golang-github-atotto-clipboard.git