mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
Update README.md, add more examples
This commit is contained in:
parent
eedf0d1855
commit
37921d6678
17
README.md
17
README.md
@ -230,6 +230,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
add()
|
||||||
|
low()
|
||||||
|
event()
|
||||||
|
}
|
||||||
|
|
||||||
|
func add() {
|
||||||
fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
|
fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
|
||||||
robotgo.EventHook(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
|
robotgo.EventHook(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
|
||||||
fmt.Println("ctrl-shift-q")
|
fmt.Println("ctrl-shift-q")
|
||||||
@ -243,7 +249,18 @@ func main() {
|
|||||||
|
|
||||||
s := robotgo.EventStart()
|
s := robotgo.EventStart()
|
||||||
<-robotgo.EventProcess(s)
|
<-robotgo.EventProcess(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func low() {
|
||||||
|
EvChan := hook.Start()
|
||||||
|
defer hook.End()
|
||||||
|
|
||||||
|
for ev := range EvChan {
|
||||||
|
fmt.Println("hook: ", ev)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func event() {
|
||||||
ok := robotgo.AddEvents("q", "ctrl", "shift")
|
ok := robotgo.AddEvents("q", "ctrl", "shift")
|
||||||
if ok {
|
if ok {
|
||||||
fmt.Println("add events...")
|
fmt.Println("add events...")
|
||||||
|
17
README_zh.md
17
README_zh.md
@ -227,6 +227,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
add()
|
||||||
|
low()
|
||||||
|
event()
|
||||||
|
}
|
||||||
|
|
||||||
|
func add() {
|
||||||
fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
|
fmt.Println("--- Please press ctrl + shift + q to stop hook ---")
|
||||||
robotgo.EventHook(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
|
robotgo.EventHook(hook.KeyDown, []string{"q", "ctrl", "shift"}, func(e hook.Event) {
|
||||||
fmt.Println("ctrl-shift-q")
|
fmt.Println("ctrl-shift-q")
|
||||||
@ -240,7 +246,18 @@ func main() {
|
|||||||
|
|
||||||
s := robotgo.EventStart()
|
s := robotgo.EventStart()
|
||||||
<-robotgo.EventProcess(s)
|
<-robotgo.EventProcess(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func low() {
|
||||||
|
EvChan := hook.Start()
|
||||||
|
defer hook.End()
|
||||||
|
|
||||||
|
for ev := range EvChan {
|
||||||
|
fmt.Println("hook: ", ev)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func event() {
|
||||||
ok := robotgo.AddEvents("q", "ctrl", "shift")
|
ok := robotgo.AddEvents("q", "ctrl", "shift")
|
||||||
if ok {
|
if ok {
|
||||||
fmt.Println("add events...")
|
fmt.Println("add events...")
|
||||||
|
Loading…
Reference in New Issue
Block a user