mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +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
|
var cmd *exec.Cmd
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "windows":
|
case "windows":
|
||||||
cmd = exec.Command("cmd", "/c", "clip")
|
cmd = exec.Command("clip")
|
||||||
case "darwin":
|
case "darwin":
|
||||||
cmd = exec.Command("pbcopy")
|
cmd = exec.Command("pbcopy")
|
||||||
case "linux":
|
case "linux":
|
||||||
|
if os.Getenv("XDG_SESSION_TYPE") == "wayland" {
|
||||||
|
cmd = exec.Command("wl-copy")
|
||||||
|
} else {
|
||||||
cmd = exec.Command("xclip", "-selection", "clipboard")
|
cmd = exec.Command("xclip", "-selection", "clipboard")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue