From 8af4171ee14488084080e1159a4c1090676830fb Mon Sep 17 00:00:00 2001 From: Alan Harris <919859+ScriptingDad@users.noreply.github.com> Date: Wed, 18 Mar 2026 23:37:24 -0400 Subject: [PATCH] fix: detach wl-copy from parent process on Wayland clipboard copy wl-copy must stay alive to hold the Wayland clipboard seat. Using cmd.Run() caused it to be killed when the clipse TUI exited, clearing the clipboard. Switching to cmd.Start() with Setsid:true detaches wl-copy into its own session so it survives the parent process exit. --- shell/wayland.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell/wayland.go b/shell/wayland.go index 1dddf36..14866d8 100644 --- a/shell/wayland.go +++ b/shell/wayland.go @@ -5,6 +5,7 @@ import ( "fmt" "os/exec" "strings" + "syscall" "github.com/savedra1/clipse/utils" ) @@ -20,7 +21,8 @@ func GetWLClipBoard() (string, error) { func UpdateWLClipboard(s string) error { cmd := exec.Command(wlCopyHandler, "--", s) - if err := cmd.Run(); err != nil { + cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true} + if err := cmd.Start(); err != nil { return err } return nil