BazecorTray is a lightweight cross-platform tray application for interacting with keyboards from Dygma like the Raise or the Defy via its serial API. It runs in the background and allows you to:
- Select the serial port connected to your keyboard.
- Select the active layer (0–9) with a single click in the tray menu.
- Send commands (
version
,layer.moveTo N
) to the keyboard and display responses in the console. - View application info (name, version, author).
- Quit the application cleanly from the tray.
- Cross-platform tray icon: Supports Windows, macOS, and Linux.
- Serial port enumeration: Detects available ports and shows USB details (VID:PID, product name).
- Persistent configuration: Saves the selected port in
bazecortray-config.json
. - Layer management: Quickly switch layers via nested tray menus.
- Automatic retries: Retries commands if the port is busy for up to 5 seconds.
- Minimal dependencies: Uses
systray
,serial
, and Go standard library.
- Build the application:
go build -o bazecortray main.go
- Place the binary and
icon.png
/icon.ico
in the same directory.
- Convert your
icon.png
to a multi-resolutionicon.ico
using ImageMagick:# If ImageMagick is on PATH as 'magick' magick icon.png -define icon:auto-resize=64,48,32,16 icon.ico
- Embed the icon into the executable with
rsrc
:go install github.com/akavel/rsrc@latest rsrc -ico icon.ico -o icon.syso
- Build as a GUI application (no console window):
Now
go build -ldflags="-H windowsgui" -o BazecorTray.exe
BazecorTray.exe
will carry the custom icon.
- Create an iconset from
icon.png
:mkdir MyIcon.iconset sips -z 16 16 icon.png --out MyIcon.iconset/icon_16x16.png sips -z 32 32 icon.png --out MyIcon.iconset/icon_16x16@2x.png sips -z 32 32 icon.png --out MyIcon.iconset/icon_32x32.png sips -z 64 64 icon.png --out MyIcon.iconset/icon_32x32@2x.png sips -z 128 128 icon.png --out MyIcon.iconset/icon_128x128.png sips -z 256 256 icon.png --out MyIcon.iconset/icon_128x128@2x.png sips -z 256 256 icon.png --out MyIcon.iconset/icon_256x256.png sips -z 512 512 icon.png --out MyIcon.iconset/icon_256x256@2x.png sips -z 512 512 icon.png --out MyIcon.iconset/icon_512x512.png sips -z 1024 1024 icon.png --out MyIcon.iconset/icon_512x512@2x.png
- Convert the iconset to
.icns
:iconutil -c icns MyIcon.iconset # produces MyIcon.icns
- Create your
.app
bundle structure:BazecorTray.app/ Contents/ MacOS/ BazecorTray ← compiled binary Resources/ MyIcon.icns ← your icon Info.plist
- Write
Contents/Info.plist
:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleName</key> <string>BazecorTray</string> <key>CFBundleExecutable</key> <string>BazecorTray</string> <key>CFBundleIconFile</key> <string>MyIcon</string> <key>CFBundleIdentifier</key> <string>de.faier.bazecortray</string> <key>CFBundleVersion</key> <string>1.0.0</string> <key>LSBackgroundOnly</key> <true/> </dict> </plist>
- Build for Apple Silicon (ARM64):
export GOOS=darwin export GOARCH=arm64 go build -o BazecorTray.app/Contents/MacOS/BazecorTray main.go
- (Optional) Universal Binary:
# Intel GOOS=darwin GOARCH=amd64 go build -o build/BazecorTray-amd64 main.go # ARM64 GOOS=darwin GOARCH=arm64 go build -o build/BazecorTray-arm64 main.go # Merge lipo -create build/BazecorTray-amd64 build/BazecorTray-arm64 -output BazecorTray.app/Contents/MacOS/BazecorTray
- Install the binary (e.g.
/usr/local/bin/bazecortray
) and icon (.png
) to/usr/local/share/icons
. - Create
/usr/share/applications/bazecortray.desktop
:[Desktop Entry] Type=Application Name=BazecorTray Exec=/usr/local/bin/bazecortray Icon=/usr/local/share/icons/bazecortray.png Categories=Utility; StartupNotify=false
- Autostart via user autostart:
# ~/.config/autostart/bazecortray.desktop [Desktop Entry] Type=Application Name=BazecorTray Exec=/usr/local/bin/bazecortray X-GNOME-Autostart-enabled=true
Run the application:
./bazecortray
- It will appear in your system tray.
- Click 📟 Select Port → choose the serial port.
- Click 🎛️ Select Layer → pick a layer (default is 2 on Windows/Linux, 0 on macOS).
- Click ℹ️ Info to print version and author to the console.
- Click 🚪 Quit to exit.
-
The selected serial port is stored in
bazecortray-config.json
:{ "Port": "COM5" }
-
You can manually edit this file if needed.
This project is licensed under the Apache License 2.0.
Attribution Requirement:
You must include the following statement in any distribution or derivative work:
This software includes code by Lars Faier.
Failure to do so violates the terms of the license.
Include a copy of the full Apache License 2.0 text in a LICENSE
file in your distribution.