Skip to content

A simple package to capture the keyboard in Windows

License

Notifications You must be signed in to change notification settings

Adrosar/gohotkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoHotKey

A simple package to capture the keyboard in Windows. (tested on Windows 10, 64-bit)

Download

go get github.com/Adrosar/gohotkey

How to use

package main

import (
	"fmt"
	"log"

	"github.com/Adrosar/gohotkey"
)

type handler struct{}

func (h *handler) Do(k gohotkey.Hotkey) {
	fmt.Println(k.String())
}

func main() {
	k := gohotkey.NewKeyboard()
	k.SetHandler(&handler{})

	k.Add(true, true, false, false, 'K')    // ALT + CTRL + K
	k.Add(false, false, false, true, 'N')   // Win + N
	k.Add(false, false, false, false, 0xB3) // Additional "play/pause" button

	err := k.Listen()
	if err != nil {
		log.Fatalln(err)
	}
}

basic example

How to build

Go to the directory where the main.go file is located and execute the command:

go build -o app.exe main.go

Early stage

The software was created for personal use and is in the early stages of development.

License

I put the software temporarily under the Go-compatible BSD license. If this prevents someone from using the software, do let me know and I'll consider changing it.

Author

Adrian Gargula | github.com/Adrosar | bitbucket.org/Adrosar