summary refs log tree commit diff stats
path: root/clipboard/selection.go
blob: 0ff5d7f310af58d3723ecaf5aa35f421e06e05f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
}