summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-03-22 00:50:12 +0530
committerAndinus <andinus@nand.sh>2020-03-22 00:50:12 +0530
commitb032caa8fed86c6a4a74fe6c7019fb6189a90471 (patch)
tree233a849286bcb632d0ecc66db420137228b4fa47
parent2a54358435676b13c1b9d20375c043cbb2ffd0f6 (diff)
downloadindus-b032caa8fed86c6a4a74fe6c7019fb6189a90471.tar.gz
Add clipboard package
-rw-r--r--clipboard/selection.go18
-rw-r--r--cmd/indus/main.go3
2 files changed, 21 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
+}
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() {}