Skip to content

An X-platform utility tool developed on Python, notifies about charging, discharging, and critically low battery state of the battery.

License

Notifications You must be signed in to change notification settings

mamolinux/battery-monitor

Repository files navigation

Logo

CI build CodeQL build License GitHub repo size GitHub release (latest by date) Open Issues Open PRs Downloads GitHub release (latest by date and asset

Many a times we forget to remove the laptop charger. This can reduce the battery life significantly due to overcharging. This is where Battery Monitor comes into play.

Battery Monitor is a utility tool developed on Python3 and PyGtk3. It will notify the user about charging, discharging, not charging and critically low state of the battery on Linux (surely if the battery is present). Along with showing the notification repetitively, It also plays a sound so that you don't miss the notification.

Contents

Download Latest Version

Stores/Ubuntu Private Archive

Add the Launchpad PPA

sudo add-apt-repository ppa:mamolinux/gui-apps
sudo apt update
sudo apt install battery-monitor

Github Releases

Get the debian package archive from GitHub. For installation, check here.

Download Source (.zip)
Download Source (.tar.gz)
Download Binary (.deb)

Features and Screenshots

Battery Monitor notifies the user:

  1. Whether battery is present,
  2. When charger is plugged in,
  3. When charger is unplugged,
  4. When battery is full and charger is not unplugged,
  5. When battery is critically low.

Additionally, it can show notifications:

  1. At three user-defined battery percentage during discharging,
  2. At one user-defined battery percentage during charging,
  3. Along with playing a sound (Mute option is not available yet).

Initial State

Initial State

Charging State

Charging State

Discharging State

Discharging State

Not Charging State

Not Charging State

Critically Low Battery State

Critically Low Battery State

Settings Window

In Settings menu, you can configure and adjust settings for Battery Monitor. Here, you can set the battery percentage levels at which you want to get notifications. The warning levels are listed in ascending order. Critical Battery Warning refers to the lowest level while First Custom Warning refers to the highest level. Custom warning levels are optional.

N.B. If you change any configuration, it will be in action only after next reboot.

Battery Monitor GUI

Dependencies

Build Dependencies

The following dependencies are required to build Battery Monitor.

gettext
desktop-file-utils
libglib2.0-bin
libgtk-4-bin
meson
python3
python3-sphinx
python3-sphinx-argparse

Runtime Dependencies

The following dependencies are required to run Battery Monitor.

acpi
gir1.2-appindicator3-0.1
gir1.2-gtk-3.0
gir1.2-notify-0.7
python3
python3-configobj
python3-gi
python3-setproctitle
python3-tldextract

Debian/Ubuntu based distro

To install runtime dependencies on Debian/Ubuntu based systems, run:

sudo apt install acpi gir1.2-appindicator3-0.1 gir1.2-gtk-3.0 \
gir1.2-notify-0.7 python3 python3-configobj python3-gi \
python3-setproctitle python3-tldextract

Note: If you are using gdebi to install Battery Monitor from a .deb file, it will automatically install the dependencies and you can skip this step.

Other Linux-based distro

Remove apt install in the command given in Debian/Ubuntu based distros and use the command for the package manager of the target system(eg. yum install, dnf install, pacman -S etc.)

Note: There might be cases where one or more dependencies might not be available for your system. But that is highly unlikely. In such situations, please create an issue.

Installation

There are two ways, this app can be installed on a Debian/Ubuntu based system.

1. Download and install binary files

Download the latest binary .deb files from here. Then install the GUI Frontend from terminal as

sudo dpkg -i battery-monitor*.deb
sudo apt install -f

2. Build and Install From Source

If you are having trouble installing the pre-built binary, build them from source.

Debian/Ubuntu based systems

There are two methods, this app can be installed/used on a Debian/Ubuntu based system. First, download and unzip the source package using:

wget https://github.com/mamolinux/battery-monitor/archive/refs/heads/master.zip
unzip master.zip
cd battery-monitor-master
  1. Option 1: Manually copying necessary files. For that, follow the steps below:

    1. Install python package sources using meson:
      rm -rf builddir
      meson setup -Dprefix=$HOME/.local builddir
      meson compile -C builddir --verbose
      meson install -C builddir
      
      It will install all files under /home/<yourusername>/.local. To remove the locally (/home/<yourusername>/.local) installed files, run:
      ninja uninstall -C builddir
      
    2. To manually install for all users:
      rm -rf builddir
      meson setup builddir
      meson compile -C builddir --verbose
      sudo meson install -C builddir
      
      The last step requires Administrative Privilege. So, be careful before using this. To remove the installed files, run:
      sudo ninja uninstall -C builddir
      
  2. Option 2: Build a debian package and install it. To build a debian package on your own:

    1. After using cd battery-monitor-master, run:

      dpkg-buildpackage --no-sign
      

      This will create a battery-monitor_*.deb package at ../battery-monitor-master.

    2. Install the debian package using

      sudo dpkg -i ../battery-monitor_*.deb
      sudo apt install -f
      

After it is installed, run battery-monitor from terminal or use the battery-monitor.desktop.

Other Linux-based systems

  1. Install the dependencies.
  2. From instructions for Debian/Ubuntu based systems, follow Option 1.

User Manual

Auto Start

Every time Battery Monitor starts automatically after PC boots up. It pops up notifications and you see its Icon in the system tray. To reveal the other beauties, you can click on the icon. Currently, there are three menus: Settings, About and Quit.

You can also start battery monitor from the menu entries. Please, search for Battery Monitor launcher in the menu entries and simply click on it. In case, if Battery Monitor doesn't start automatically, please open an issue. We would like to debug the issue and help you.

Issue Tracking and Contributing

If you are interested to contribute and enrich the code, you are most welcome. You can do it by:

  1. If you find a bug, to open a new issue with details: Click Here
  2. If you know how to fix a bug or want to add new feature/documentation to the existing package, please create a Pull Request.

NB: Using the issue template or PR template is not mandatory.

For Developers

I am managing these apps all by myself during my free time. There are times when I can't contribute for months. So a little help is always welcome. If you want to test Battery Monitor,

  1. Get the source package and unzip it using:
    wget https://github.com/mamolinux/battery-monitor/archive/refs/heads/master.zip
    unzip master.zip
    cd battery-monitor-master
    
  2. Make desired modifications.
  3. Manually install using option 2.
  4. Test it by running in debug mode from terminal:
    battery-monitor --verbose
    

Translation

All translations are done using using Launchpad Translations. To help translate Battery Monitor in your favourite language follow these steps:

  1. Go to translations page on Launchpad.
  2. Click on the language, you want to translate.
  3. Translate strings.
  4. Finally, click on Save & Continue.

Contributors

Current maintainer.

He is the original creator of now archived Battery Monitor. We are highly grateful to him for offering this useful app and providing the base for the current Battery Monitor. Please take a minute to thank him.

He has reformatted the code in a new style. The style represents the code easier to understand. Also, he has optimized the code in a way that Battery Monitor consumes a little resource of your PC. Please take a minute to thank him.

He has fixed some bugs and optimized Battery Monitor in a way so that it consumes lower CPU and RAM than before. Please take a minute to thank him.

He is our official package maintainer in AUR. He has put Arch users' life at ease. Please take a minute to thank him.

He has improved the build process and added modern Python setuptools packaging. Please take a minute to thank him.

Donations

I am a freelance programmer. So, If you like this app and would like to offer me a coffee ( ☕ ) to motivate me further, you can do so via: