A simple CLI utility to get the battery level of Dygma keyboards.
Because only one process can use the serial port at a time, this app is designed to run, get the battery level, print it to standard output, and exit immediately.
It is designed to work with status bars like waybar, but its simple JSON output makes it easy to integrate with other tools and scripts.
This tool is mainly intended for and tested on linux, but it may work on other platforms as well!
On Arch linux you can use the AUR dygma-indicator-bin
go install github.com/coolapso/dygma-indicator
go install github.com/coolapso/dygma-indicator@v1.0.0
It is also impossible to install on any linux distro with the installation script
curl -L https://dygma-indicator.coolapso.sh/install.sh | bash
curl -L https://dygma-indicator.coolapso.sh/install.sh | VERSION="v1.1.0" bash
- Grab the binary from the releases page.
- Extract the binary
- Execute it
Warning
Device detection on MacOS is entirely vibe coded as I have no clue how macs work! If you have a mac and want to make it better, feel free to contribute!
At the moment there's nothing speciall about it, just execute it and it will print the battery level to standard output.
dygma-indicatorThe application outputs a JSON object with the battery percentage and a corresponding text status.
{"text":"L:50% R:70%","tooltip":"Left side: 50%\rRight side: 70%","percentage":50}
To use this with waybar, add the following configuration to your config file.
"custom/keyboard": {
"format": "{icon} {text}",
"return-type": "json",
"interval": 3600,
"format-icons": [
"",
"",
"",
"",
""
],
"max-length": 40,
"escape": true,
"exec": "dygma-indicator"
},Important
The serial protocol used by the keyboard can only be used by one application at a time. It is recommended to set a reasonably high interval (e.g., 3600 seconds) to avoid blocking other applications like Bazecor when you need to use them.
Improvements and suggestions are always welcome, feel free to check for any open issues, open a new Issue or Pull Request
If you like this project and want to support / contribute in a different way you can always ❤️ Sponsor Me or

