Skip to content

coolapso/dygma-indicator

Repository files navigation

Dygma Indicator

Release GitHub Tag Go Report Card GitHub Sponsors

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.

Installation

This tool is mainly intended for and tested on linux, but it may work on other platforms as well!

AUR

On Arch linux you can use the AUR dygma-indicator-bin

Go Install

Latest version

go install github.com/coolapso/dygma-indicator

Specific version

go install github.com/coolapso/dygma-indicator@v1.0.0

Linux Script

It is also impossible to install on any linux distro with the installation script

Latest version

curl -L https://dygma-indicator.coolapso.sh/install.sh | bash

Specific version

curl -L https://dygma-indicator.coolapso.sh/install.sh | VERSION="v1.1.0" bash

Manual install

  • 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!

Usage

At the moment there's nothing speciall about it, just execute it and it will print the battery level to standard output.

dygma-indicator

output

The 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}

Waybar

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.

Contributions

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

Buy Me A Coffee

About

A simple CLI utility to get the battery level of Dygma keyboards.

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published