diff options
author | Andinus <andinus@nand.sh> | 2020-03-22 00:50:12 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-03-22 00:50:12 +0530 |
commit | b032caa8fed86c6a4a74fe6c7019fb6189a90471 (patch) | |
tree | 233a849286bcb632d0ecc66db420137228b4fa47 /clipboard | |
parent | 2a54358435676b13c1b9d20375c043cbb2ffd0f6 (diff) | |
download | indus-b032caa8fed86c6a4a74fe6c7019fb6189a90471.tar.gz |
Add clipboard package
Diffstat (limited to 'clipboard')
-rw-r--r-- | clipboard/selection.go | 18 |
1 files changed, 18 insertions, 0 deletions
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 +} |