2020-11-02 04:09:48 +13:00
|
|
|
package desktop
|
|
|
|
|
|
|
|
import (
|
2021-01-29 09:12:35 +13:00
|
|
|
"os/exec"
|
|
|
|
"strings"
|
2020-11-02 04:09:48 +13:00
|
|
|
)
|
|
|
|
|
2021-01-29 09:12:35 +13:00
|
|
|
func (manager *DesktopManagerCtx) ReadClipboard() (string, error) {
|
|
|
|
out, err := exec.Command("xclip", "-selection", "clipboard", "-o").Output()
|
|
|
|
return string(out), err
|
2020-11-02 04:09:48 +13:00
|
|
|
}
|
|
|
|
|
2021-01-29 09:12:35 +13:00
|
|
|
func (manager *DesktopManagerCtx) WriteClipboard(data string) error {
|
|
|
|
cmd := exec.Command("xclip", "-selection", "clipboard", "-i")
|
|
|
|
cmd.Stdin = strings.NewReader(data)
|
|
|
|
return cmd.Run()
|
2020-11-02 04:09:48 +13:00
|
|
|
}
|