init commit

This commit is contained in:
ysandler
2026-01-27 22:01:30 -06:00
commit ee23a4f39c
22 changed files with 1605 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
package clipboard
import "os"
type DisplayServer int
const (
DisplayServerUnknown DisplayServer = iota
DisplayServerX11
DisplayServerWayland
)
// Detect returns the current display server type
func Detect() DisplayServer {
// Check for Wayland first
if os.Getenv("WAYLAND_DISPLAY") != "" {
return DisplayServerWayland
}
// Check for X11
if os.Getenv("DISPLAY") != "" {
return DisplayServerX11
}
return DisplayServerUnknown
}
// New creates a clipboard implementation for the current display server
func New() (Clipboard, error) {
switch Detect() {
case DisplayServerWayland:
return NewWayland()
case DisplayServerX11:
return NewX11()
default:
// Try X11 as fallback
return NewX11()
}
}