mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-28 04:46:41 -04:00
Clear clipboard when copy process is closed
This commit is contained in:
@@ -5,7 +5,7 @@ go 1.25.4
|
||||
require (
|
||||
github.com/charmbracelet/glamour v0.7.0
|
||||
github.com/rwinkhart/go-boilerplate v0.1.0
|
||||
github.com/rwinkhart/libmutton v0.4.3-0.20251110042347-bf1399ce8d6e
|
||||
github.com/rwinkhart/libmutton v0.4.3-0.20251110045726-97037903360c
|
||||
golang.org/x/term v0.36.0
|
||||
)
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ github.com/rwinkhart/go-highlite v0.1.1 h1:9TxbRhYVfD/3YaEgNk1BtEiZ0t8/5mxDUZqNM
|
||||
github.com/rwinkhart/go-highlite v0.1.1/go.mod h1:mWLMtCWcyV0BG4NeyPyAUGMjPvI0ds6vXmUq89QwBFA=
|
||||
github.com/rwinkhart/go-winio v0.1.0 h1:b72agLW+dETGmhR3VbcbwnStfgKfc5AfgJOXBJDkaHg=
|
||||
github.com/rwinkhart/go-winio v0.1.0/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0=
|
||||
github.com/rwinkhart/libmutton v0.4.3-0.20251110042347-bf1399ce8d6e h1:AL7cSPkdiv69uFrBCMJAQP1PPG0LN1mBeOFqQuF+j7k=
|
||||
github.com/rwinkhart/libmutton v0.4.3-0.20251110042347-bf1399ce8d6e/go.mod h1:ZXDCjk1Wec5UJK8ID9AF+jqicWoZmMGzuaPw1Unu3HQ=
|
||||
github.com/rwinkhart/libmutton v0.4.3-0.20251110045726-97037903360c h1:awL7Q4rzd0FLoi+qaZnwC+SMby2OYf7yNf5Z1NIi+8o=
|
||||
github.com/rwinkhart/libmutton v0.4.3-0.20251110045726-97037903360c/go.mod h1:ZXDCjk1Wec5UJK8ID9AF+jqicWoZmMGzuaPw1Unu3HQ=
|
||||
github.com/rwinkhart/peercred-mini v0.1.2 h1:4cGWDbv0whvLeVvbUdx84V/9p+2fS+DEXgrA1KxlRFo=
|
||||
github.com/rwinkhart/peercred-mini v0.1.2/go.mod h1:LLHG7YshHEpbpJJP+Il9nx2dnGj5O3VGE32rWmflj0c=
|
||||
github.com/rwinkhart/rcw v0.2.3 h1:g1rVaspZnZM8nWupeSdVO827di4ORMZnczw6iXyo01Y=
|
||||
|
||||
+12
-1
@@ -2,6 +2,9 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/go-boilerplate/front"
|
||||
@@ -36,6 +39,15 @@ func CopyMenu(targetLocation string) {
|
||||
}
|
||||
}
|
||||
|
||||
// set up signal handling for ctrl+c to clear clipboard
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-sigChan
|
||||
clip.ClipClearProcess("")
|
||||
os.Exit(0)
|
||||
}()
|
||||
|
||||
// copy selected field to clipboard
|
||||
for {
|
||||
choice := front.InputMenuGen("Field to copy:", fields)
|
||||
@@ -78,5 +90,4 @@ func CopyMenu(targetLocation string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO clear clipboard on exit!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user