Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gianlucaguarini/osxkeyboard
Go helper script to detect the global keypress events on OSX
https://github.com/gianlucaguarini/osxkeyboard
Last synced: about 1 month ago
JSON representation
Go helper script to detect the global keypress events on OSX
- Host: GitHub
- URL: https://github.com/gianlucaguarini/osxkeyboard
- Owner: GianlucaGuarini
- License: mit
- Created: 2016-01-10T18:14:12.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-29T13:39:46.000Z (almost 7 years ago)
- Last Synced: 2024-10-05T11:54:34.999Z (about 2 months ago)
- Language: C
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OSXKeyboard
Go helper to detect the global keypress events on OSX, it requires the root permissions enabled# Installation
```bash
go get github.com/GianlucaGuarini/OSXKeyboard
```# API
## Listen
Call it once to start listening the global keyboard events
## Subscribe(interface {})
Subscribe to the keypress events receiving the letter pressed as string
## Unsubscribe(interface {})
Unsubscribe a specific callback to the keypress events
# Usage
Build the following file from your `go/src` folder and then run it with `sudo`
```go
package mainimport (
"fmt"
"github.com/GianlucaGuarini/OSXKeyboard"
)func main() {
go OSXKeyboard.Listen()OSXKeyboard.Subscribe(func(letter string) {
fmt.Println(letter)
})select {} // block forever
}
```