Skip to content

Commit

Permalink
Merge pull request #824 from bitraid/improve-clipboard-copy
Browse files Browse the repository at this point in the history
Improve clipboard copy
  • Loading branch information
schollz authored Oct 12, 2024
2 parents 0d48e34 + 1adf845 commit 917d9f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/croc/croc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 917d9f1

Please sign in to comment.