mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-09-02 07:07:26 -04:00
Export LaunchClipClearProcess; use more reliable method to manipulate os.Args for GUI clients
This commit is contained in:
@@ -31,7 +31,7 @@ func copyString(continuous bool, copySubject string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !continuous {
|
if !continuous {
|
||||||
launchClipClearProcess(copySubject, isWayland)
|
LaunchClipClearProcess(copySubject, isWayland)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// launchClipClearProcess launches the automated clipboard clearing process.
|
// LaunchClipClearProcess launches the timed clipboard clearing process.
|
||||||
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
|
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
|
||||||
func launchClipClearProcess(copySubject string) {
|
func LaunchClipClearProcess(copySubject string) {
|
||||||
executableName := os.Args[0]
|
executableName := os.Args[0]
|
||||||
cmd := exec.Command(executableName, "clipclear")
|
cmd := exec.Command(executableName, "clipclear")
|
||||||
writeToStdin(cmd, copySubject)
|
writeToStdin(cmd, copySubject)
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// launchClipClearProcess launches the automated clipboard clearing process.
|
// LaunchClipClearProcess launches the timed clipboard clearing process.
|
||||||
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
|
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
|
||||||
func launchClipClearProcess(copySubject string, isWayland bool) {
|
func LaunchClipClearProcess(copySubject string, isWayland bool) {
|
||||||
executableName := os.Args[0]
|
executableName := os.Args[0]
|
||||||
cmd := exec.Command(executableName, "clipclear", strconv.FormatBool(isWayland))
|
cmd := exec.Command(executableName, "clipclear", strconv.FormatBool(isWayland))
|
||||||
writeToStdin(cmd, copySubject)
|
writeToStdin(cmd, copySubject)
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
package core
|
package core
|
||||||
|
|
||||||
// launchClipClearProcess launches the automated clipboard clearing process.
|
// LaunchClipClearProcess launches the timed clipboard clearing process.
|
||||||
// For interactive GUI/TUI implementations, the clipboard clearing process is launched as a goroutine.
|
// For interactive GUI/TUI implementations, the clipboard clearing process is launched as a goroutine.
|
||||||
func launchClipClearProcess(copySubject string) {
|
// copySubject can be omitted to clear the clipboard immediately and unconditionally.
|
||||||
go clipClearProcess(copySubject)
|
func LaunchClipClearProcess(copySubject string) {
|
||||||
|
go ClipClearProcess(copySubject)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// launchClipClearProcess launches the automated clipboard clearing process.
|
// LaunchClipClearProcess launches the timed clipboard clearing process.
|
||||||
// For interactive GUI/TUI implementations, the clipboard clearing process is launched as a goroutine.
|
// For interactive GUI/TUI implementations, the clipboard clearing process is launched as a goroutine.
|
||||||
func launchClipClearProcess(copySubject string, isWayland bool) {
|
// copySubject can be omitted to clear the clipboard immediately and unconditionally.
|
||||||
os.Args[2] = strconv.FormatBool(isWayland)
|
func LaunchClipClearProcess(copySubject string, isWayland bool) {
|
||||||
|
os.Args = []string{os.Args[0], "", strconv.FormatBool(isWayland)}
|
||||||
go clipClearProcess(copySubject)
|
go clipClearProcess(copySubject)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user