I wrote a small shortcut helper in GoLang that helps me to remember the most useful shortcuts for IntelliJ based products tested with Rider and GoLand and a QWERTZ keyboard.
Intro
I recently bought a Logitech G815 which turned out to be a great decision for multiple reasons. The obvious one being that it's a great keyboard ✨. The other one is that I found out Logitech provides an SDK for the keyboard => 👌.
RGB Keys
The keyboard supports RGB background lighting for each key. There are plenty of integrated functions such as a color wave which looks great🌟. The keyboard is made for gaming purposes and yes it does integrate with a lot of games but I didn't try any myself🙈.
typeLogiKeyboardstruct{dll*windows.LazyDLLledInit*windows.LazyProc// ...}funcCreate()*LogiKeyboard{p:=new(LogiKeyboard)// initialization of the dllp.dll=windows.NewLazyDLL("LogitechLedEnginesWrapper.dll")// assign the functionp.ledInit=p.dll.NewProc("LogiLedInit")//...returnp}// wrapper for the init functionfunc(vLogiKeyboard)Init(){ret,_,_:=v.ledInit.Call()ifret!=1{log.Fatal("Already initialized")}}
Additionally, I had to translate the .h file in go syntax. This helps to have all the constants (like defines) in one place and reduce code duplication. Here is the file.
Integration with Windows
I needed a slim and easy way to catch Windows keystrokes. Turns out there is a great module for that as well: github.com/moutend/go-hook.
main.go:
iferr:=run(shortcuts);err!=nil{log.Fatal(err)}funcrun(shortcuts[]Shortcuts.Shortcut)error{// Buffer size is depends on your need. The 100 is placeholder value.keyboardChan:=make(chantypes.KeyboardEvent,100)iferr:=keyboard.Install(nil,keyboardChan);err!=nil{returnerr}signalChan:=make(chanos.Signal,1)signal.Notify(signalChan,os.Interrupt)for{select{case<-time.After(5*time.Minute):fmt.Println("Received timeout signal")returnnilcase<-signalChan:fmt.Println("Received shutdown signal")returnnilcasek:=<-keyboardChan:// check if shortcut modifiers are pressed and set RGB color}continue}}
Those few lines of code are everything you need to create a keylogger in go. Isn't that crazy?
Shortcuts
Shortcuts can be modified in main.go:
varshortcuts=[]Shortcuts.Shortcut{// if the left shift key is presed:// F6 will start blinking red// F9 will change the color to blueShortcuts.CreateWithKey([]types.VKCode{types.VK_LSHIFT},[]Shortcuts.ShortcutKey{Shortcuts.CreateKeyColorEffect(LogiKeyboardTypes.F6,100,0,0,Shortcuts.Blinking),Shortcuts.CreateKeyColor(LogiKeyboardTypes.F9,0,0,100),}),//...}
Integration with Logitech GHub
The keyboard has five G keys and each key can be assigned with a different task. One task is to launch an application => great :). The downside of this function is that an application can be started but not stopped. I wanted to start and stop the shortcut helper with the same key just like a toggle.
This is a little shortcut helper written in GO 👨💻. The software can be started using one of the G keys. Once started the process profiles every keystroke made on the keyboard. If a certain combination ex. SHIFT+CTRL is pressed the most important shortcuts for Rider / GoLang are visualized on the keyboard using the RGB key background lightning 💡.
Here's a quick example (sorry for the bad quality, the keys are shining bright and clear in reality🙈):
Here's another one:
How to install 💻
Clone the repo
Build the source code go build -o LogitechKeyboardLED.exe ./ (win only)
Navigate to the GHub
Add a new launch command with the following params:
The script checks the state of the process and starts it if the process is stopped, and stops it if the process is running. This way…