Skip to content

gabrielbotandev/minusb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minusb

A lightweight, fast, native Linux GUI for checking your laptop battery info. Written in C with GTK4 and libadwaita, it shows organized battery statistics read directly from the Linux power_supply sysfs interface (/sys/class/power_supply) - no root, no sudo, no background daemon.

  • No Qt, no Electron, no Python, no webview.
  • Reads world-readable sysfs files, so it never needs elevated privileges.
  • Starts quickly and uses minimal memory.
  • Works on any Linux laptop, not a specific vendor.

Features

  • Auto-detects every battery under /sys/class/power_supply (laptop packs like BAT0/BAT1, and even peripherals such as wireless mice).
  • Tags each battery as System or Device and lets you switch between them with a dropdown when more than one is present.
  • Organized sections: Overview, Health, Energy / Charge, Power, Hardware.
  • Any sysfs value that does not exist is shown as N/A (no crashes).
  • Follows your system light/dark theme automatically (via libadwaita).
  • Refresh button and an optional Auto 30s auto-refresh toggle.
  • Converts raw micro-units into human-readable values:
    • voltage_now uV -> V
    • power_now uW -> W
    • current_now uA -> A
    • energy_* uWh -> Wh
    • charge_* uAh -> Ah
  • Computes battery health % as energy_full / energy_full_design * 100 (falls back to the charge_* pair). Values slightly above 100% are shown as-is, since freshly-calibrated packs can report energy_full above the design value.
  • Shows charge-control thresholds when the kernel/driver exposes them.

Quick install (recommended)

Clone or download this project, then run the installer:

./install.sh

It will:

  1. Check for the GTK4 development files, a C compiler, make, and pkg-config. If any are missing, it installs them using your distro's package manager (this one step asks for sudo).
  2. Build minusb.
  3. Install the binary into ~/.local/bin/minusb and a launcher into ~/.local/share/applications/.

After it finishes, minusb appears in your applications menu (under Utility/System). You can also launch it from a terminal with minusb.

If the installer warns that ~/.local/bin is not on your PATH, add this to your shell config (e.g. ~/.bashrc or ~/.zshrc):

export PATH="$HOME/.local/bin:$PATH"

Uninstall

./uninstall.sh

This removes the binary and the launcher from ~/.local. (make uninstall does the same thing if you prefer.)

Build from source

If you prefer to install dependencies and build manually, see BUILD.md for per-distro instructions.

Why no root is needed

The Linux kernel exposes battery data through the power_supply class in sysfs (/sys/class/power_supply/BAT0/...). These attribute files are world-readable, so any unprivileged user can read capacity, status, energy_now, voltage_now, and so on. minusb only reads those files, so it never needs root, sudo, or any helper daemon. (Many battery-inspection tools require root; minusb does not.)

Root is only required to write certain attributes (for example changing a charge threshold) or to access vendor/ACPI/EC registers directly. minusb does none of that.

Which values may not be available from sysfs

Some details that other battery tools display are not exposed as plain, unprivileged sysfs attributes, so they appear as N/A here (or are simply omitted):

  • Battery temperature - often only available via hwmon nodes or the embedded controller, frequently requiring root or driver-specific access.
  • Manufacture date / first-use date - read from the SMBus/embedded controller by vendor utilities, not from standard sysfs.
  • Vendor diagnostics & detailed pack data - exposed through ACPI calls, SMBus, or smartctl-style tooling rather than power_supply sysfs.
  • Force discharge / recalibration controls - write-only operations that require root and specific driver support.
  • current_now / charge_* on packs that report the energy model: many laptops expose energy_now/power_now instead of charge_now/current_now. minusb automatically displays whichever set the battery provides.

Sysfs fields read

capacity, capacity_level, status, cycle_count, manufacturer, model_name, serial_number, technology, energy_now, energy_full, energy_full_design, charge_now, charge_full, charge_full_design, power_now, current_now, voltage_now, charge_control_start_threshold, charge_control_end_threshold.

Project structure

.
├── src/main.c                                  # entire app (single file)
├── Makefile                                    # build + install/uninstall
├── install.sh                                  # one-command installer
├── uninstall.sh                                # one-command uninstaller
├── data/io.github.gabrielbotandev.minusb.desktop   # menu launcher
├── README.md
└── BUILD.md                                    # build-from-source guide

License

Licensed under the MIT License; see LICENSE.

About

Lightweight, fast, native Linux GUI for checking your laptop battery info.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors