From b032caa8fed86c6a4a74fe6c7019fb6189a90471 Mon Sep 17 00:00:00 2001 From: Andinus Date: Sun, 22 Mar 2020 00:50:12 +0530 Subject: Add clipboard package --- clipboard/selection.go | 18 ++++++++++++++++++ cmd/indus/main.go | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 clipboard/selection.go create mode 100644 cmd/indus/main.go diff --git a/clipboard/selection.go b/clipboard/selection.go new file mode 100644 index 0000000..0ff5d7f --- /dev/null +++ b/clipboard/selection.go @@ -0,0 +1,18 @@ +package clipboard + +import ( + "os/exec" +) + +// GetSel returns the primary clipboard selection using the xclip tool +// & also returns an error (if exists) along with the primary +// clipboard selection. +func GetSel() (string, error) { + out, err := exec.Command("xclip", "-out").Output() + if err != nil { + return "", err + } + + sel := string(out) + return sel, err +} diff --git a/cmd/indus/main.go b/cmd/indus/main.go new file mode 100644 index 0000000..38dd16d --- /dev/null +++ b/cmd/indus/main.go @@ -0,0 +1,3 @@ +package main + +func main() {} -- cgit 1.4.1-2-gfad0