mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-08-27 20:36:29 -04:00
Export ClipClearProcess()
This commit is contained in:
@@ -10,9 +10,9 @@ import (
|
|||||||
"golang.design/x/clipboard"
|
"golang.design/x/clipboard"
|
||||||
)
|
)
|
||||||
|
|
||||||
// clipClearProcess clears the clipboard after 30 seconds if the clipboard contents have not changed.
|
// ClipClearProcess clears the clipboard after 30 seconds if the clipboard contents have not changed.
|
||||||
// assignedContents can be omitted to clear the clipboard immediately and unconditionally.
|
// assignedContents can be omitted to clear the clipboard immediately and unconditionally.
|
||||||
func clipClearProcess(assignedContents string) error {
|
func ClipClearProcess(assignedContents string) error {
|
||||||
clearClipboard := func() {
|
clearClipboard := func() {
|
||||||
clipboard.Write(clipboard.FmtText, []byte(""))
|
clipboard.Write(clipboard.FmtText, []byte(""))
|
||||||
back.Exit(0)
|
back.Exit(0)
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import (
|
|||||||
"github.com/rwinkhart/go-boilerplate/back"
|
"github.com/rwinkhart/go-boilerplate/back"
|
||||||
)
|
)
|
||||||
|
|
||||||
// clipClearProcess clears the clipboard after 30 seconds if the clipboard contents have not changed.
|
// ClipClearProcess clears the clipboard after 30 seconds if the clipboard contents have not changed.
|
||||||
// assignedContents can be omitted to clear the clipboard immediately and unconditionally.
|
// assignedContents can be omitted to clear the clipboard immediately and unconditionally.
|
||||||
func clipClearProcess(assignedContents string) error {
|
func ClipClearProcess(assignedContents string) error {
|
||||||
cmdPaste, cmdClear := getClipCommands()
|
cmdPaste, cmdClear := getClipCommands()
|
||||||
|
|
||||||
clearClipboard := func() error {
|
clearClipboard := func() error {
|
||||||
|
|||||||
@@ -71,6 +71,6 @@ func ClipClearArgument() error {
|
|||||||
if assignedContents == "" {
|
if assignedContents == "" {
|
||||||
os.Exit(0) // use os.Exit instead of core.Exit, as this function runs out of a background subprocess that is invisible to the user (will never appear in GUI/TUI environment)
|
os.Exit(0) // use os.Exit instead of core.Exit, as this function runs out of a background subprocess that is invisible to the user (will never appear in GUI/TUI environment)
|
||||||
}
|
}
|
||||||
err := clipClearProcess(assignedContents)
|
err := ClipClearProcess(assignedContents)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user