fix not working in systemd injection

This commit is contained in:
LeonardoTrapani
2025-10-10 19:27:52 +02:00
parent 8f94df4ad3
commit b437f575e6
4 changed files with 27 additions and 4 deletions
+10
View File
@@ -3,6 +3,7 @@ package injection
import (
"context"
"fmt"
"os"
"os/exec"
"strings"
"time"
@@ -44,5 +45,14 @@ func checkClipboardAvailable() error {
return fmt.Errorf("wl-paste not found: %w (install wl-clipboard)", err)
}
// Check for Wayland environment
if os.Getenv("WAYLAND_DISPLAY") == "" {
return fmt.Errorf("WAYLAND_DISPLAY not set - clipboard operations require Wayland session")
}
if os.Getenv("XDG_RUNTIME_DIR") == "" {
return fmt.Errorf("XDG_RUNTIME_DIR not set - clipboard operations require proper session environment")
}
return nil
}