https://github.com/obgnail/share-clipboard
跨设备共享剪切板
https://github.com/obgnail/share-clipboard
clipboard clipboard-share golang hotkeys
Last synced: 3 months ago
JSON representation
跨设备共享剪切板
- Host: GitHub
- URL: https://github.com/obgnail/share-clipboard
- Owner: obgnail
- Created: 2022-05-19T15:29:48.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-22T09:16:13.000Z (over 3 years ago)
- Last Synced: 2025-05-16T18:12:14.515Z (5 months ago)
- Topics: clipboard, clipboard-share, golang, hotkeys
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 共享剪切板工具
### usage
server:
```go
package mainimport (
clipboard "github.com/obgnail/share-clipboard"
)func main() {
addr := "192.168.3.3:8899"
clipboard.ServerRun(addr)
}
```peer:
```go
package mainimport (
"github.com/juju/errors"
clipboard "github.com/obgnail/share-clipboard"
log "github.com/sirupsen/logrus"
"golang.design/x/hotkey/mainthread"
)func main() { mainthread.Init(fn) }
func fn() {
addr := "192.168.3.3:8899"
sendHK := "Alt+C"
loadHK := "Alt+V"err := clipboard.ListenHotKey(sendHK, func() {
clipboard.PeerSendClipboard(addr)
})
if err != nil {
log.Error(errors.ErrorStack(err))
}
err = clipboard.ListenHotKey(loadHK, func() {
clipboard.PeerLoadClipboard(addr)
})
if err != nil {
log.Error(errors.ErrorStack(err))
}forever := make(chan struct{}, 1)
<-forever
}
```