mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
18 lines
417 B
Go
18 lines
417 B
Go
package desktop
|
|
|
|
import (
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
func (manager *DesktopManagerCtx) ReadClipboard() (string, error) {
|
|
out, err := exec.Command("xclip", "-selection", "clipboard", "-o").Output()
|
|
return string(out), err
|
|
}
|
|
|
|
func (manager *DesktopManagerCtx) WriteClipboard(data string) error {
|
|
cmd := exec.Command("xclip", "-selection", "clipboard", "-i")
|
|
cmd.Stdin = strings.NewReader(data)
|
|
return cmd.Run()
|
|
}
|