mirror of
https://github.com/schollz/croc.git
synced 2025-10-10 21:01:02 +02:00
Merge pull request #824 from bitraid/improve-clipboard-copy
Improve clipboard copy
This commit is contained in:
commit
917d9f16b4
1 changed files with 6 additions and 2 deletions
|
@ -2129,11 +2129,15 @@ func copyToClipboard(str string) {
|
|||
var cmd *exec.Cmd
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
cmd = exec.Command("cmd", "/c", "clip")
|
||||
cmd = exec.Command("clip")
|
||||
case "darwin":
|
||||
cmd = exec.Command("pbcopy")
|
||||
case "linux":
|
||||
cmd = exec.Command("xclip", "-selection", "clipboard")
|
||||
if os.Getenv("XDG_SESSION_TYPE") == "wayland" {
|
||||
cmd = exec.Command("wl-copy")
|
||||
} else {
|
||||
cmd = exec.Command("xclip", "-selection", "clipboard")
|
||||
}
|
||||
default:
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue