configuration file
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// getClipboard retrieves the current clipboard content using wl-paste
|
||||
func getClipboard(ctx context.Context, timeout time.Duration) (string, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
@@ -16,15 +15,12 @@ func getClipboard(ctx context.Context, timeout time.Duration) (string, error) {
|
||||
cmd := exec.CommandContext(ctx, "wl-paste", "--no-newline")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
// wl-paste returns non-zero exit code if clipboard is empty or unavailable
|
||||
// This is normal behavior, so we return empty string instead of error
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return string(output), nil
|
||||
}
|
||||
|
||||
// setClipboard sets the clipboard content using wl-copy
|
||||
func setClipboard(ctx context.Context, text string, timeout time.Duration) error {
|
||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
@@ -39,7 +35,6 @@ func setClipboard(ctx context.Context, text string, timeout time.Duration) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkClipboardAvailable checks if wl-clipboard tools are available
|
||||
func checkClipboardAvailable() error {
|
||||
if _, err := exec.LookPath("wl-copy"); err != nil {
|
||||
return fmt.Errorf("wl-copy not found: %w (install wl-clipboard)", err)
|
||||
|
||||
Reference in New Issue
Block a user