split remote to desktop and capture.

This commit is contained in:
Miroslav Šedivý
2022-09-12 22:12:47 +02:00
parent 0bca8c9d02
commit de4f6b45e5
26 changed files with 299 additions and 194 deletions

View File

@ -0,0 +1,35 @@
package clipboard
/*
#cgo linux LDFLAGS: /usr/local/lib/libclipboard.a -lxcb
#include "clipboard.h"
*/
import "C"
import (
"sync"
"unsafe"
)
var mu = sync.Mutex{}
func Read() string {
mu.Lock()
defer mu.Unlock()
clipboardUnsafe := C.ClipboardGet()
defer C.free(unsafe.Pointer(clipboardUnsafe))
return C.GoString(clipboardUnsafe)
}
func Write(data string) {
mu.Lock()
defer mu.Unlock()
clipboardUnsafe := C.CString(data)
defer C.free(unsafe.Pointer(clipboardUnsafe))
C.ClipboardSet(clipboardUnsafe)
}