fix: daemonize wl-copy
This commit is contained in:
parent
ef9e6bece2
commit
e1dea61d31
2 changed files with 9 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
**Notable bug fixes**
|
||||
|
||||
- wl-copy is now truly daemonized, allowing calling `alacritty -e sh -c clipman pick`
|
||||
- fzf couldn't recover the clipboard content in some cases
|
||||
|
||||
# 1.5.1
|
||||
|
|
9
main.go
9
main.go
|
@ -11,6 +11,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
@ -178,8 +179,14 @@ func serveTxt(s string) {
|
|||
smartLog(fmt.Sprintf("couldn't find wl-copy: %v\n", err), "low", *alert)
|
||||
}
|
||||
|
||||
// daemonize wl-copy into a truly independent process
|
||||
// necessary for running stuff like `alacritty -e sh -c clipman pick`
|
||||
attr := &syscall.SysProcAttr{
|
||||
Setpgid: true,
|
||||
}
|
||||
|
||||
// we mandate the mime type because we know we can only serve text; not doing this leads to weird bugs like #35
|
||||
cmd := exec.Cmd{Path: bin, Args: []string{bin, "-t", "TEXT"}, Stdin: strings.NewReader(s)}
|
||||
cmd := exec.Cmd{Path: bin, Args: []string{bin, "-t", "TEXT"}, Stdin: strings.NewReader(s), SysProcAttr: attr}
|
||||
if err := cmd.Run(); err != nil {
|
||||
smartLog(fmt.Sprintf("error running wl-copy: %s\n", err), "low", *alert)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue