Skip to content

GNOME Shell Extension to display the battery level of AirPods in the top bar.

Notifications You must be signed in to change notification settings

ramiro-uziel/gnome-airpods-battery-status

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AirPods Battery Status for GNOME 45

A GNOME Shell Extension to display the battery level of your AirPods in the top bar.

https://github.com/ramiro-uziel/gnome-airpods-battery-status/blob/main/screenshot.png

Shows the average of the Pods' battery reads.

https://github.com/ramiro-uziel/gnome-airpods-battery-status/blob/main/screenshot2.png

Popup menu.

animations.mp4

Connect and disconnect animations. Yes it's 4 am.

Features

  • Shows average value of Pods' batteries
  • Hides icons when the battery value is null, and dash value when all values are null. Has 3 minute timeout to hide them.
  • Shows charging status with Adawita icons
  • Shows the time of the last update
  • Reimplementation of AirStatus Python script

Has support for

  • AirPods 1
  • AirPods 2
  • AirPods 3
  • AirPods Pro
  • AirPods Pro 2
  • AirPods Max

Warning

  1. The Python script used in this extension can misread info sometimes and can read other AirPods' battery info if used around many.
  2. If you are using a laptop, keep in mind that the Python script may affect battery life.
  3. The extension has not been tested extensively.
  4. This is my first GNOME shell extension. If you know GJS and see something weird feel free to contribute.

Installation

GNOME Shell Extension

First clone the extension's repo by doing the following:

$ mkdir -p ~/.local/share/gnome-shell/extensions/[email protected]
$ cd ~/.local/share/gnome-shell/extensions/[email protected]
$ git clone https://github.com/ramiro-uziel/gnome-airpods-battery-status .

Don't enable the extension until you do the next step.

Helper Python script

Install the python script (from this repo) as a service.

Create the file /etc/systemd/system/airstatus.service (as root) containing:

[Unit]
Description=AirPods Battery Monitor

[Service]
ExecStart=/usr/bin/python3 /PATH/TO/main.py
Restart=always
RestartSec=3

[Install]
WantedBy=default.target

Then start the service:

sudo systemctl start airstatus

And finally enable the service on boot:

sudo systemctl enable airstatus

Restart the system and enable the extension.

Changelog

  • Updated for GNOME 45
  • New dash icon
  • The battery value in the dash is the average of both Pods' batteries
  • Hides icons when the battery value is null, and dash value when all values are null (when AirPods disconnect, loose power or just glitch out). Has 30 second timeout.
  • Shows charging status with icons instead of text
  • Shows the time of the last update
  • Reimplementation of AirStatus Python script

To-do

  • Add icon switching depending on model string
  • Add settings menu

Credit

This is a fork of this gnome extension from delphiki.

The python script is a modified version of this script by andirsun.

The python script is possible thanks to this paper. We know just enough about Apple's BLE protocol that we can extract the battery info from the raw data.

About

GNOME Shell Extension to display the battery level of AirPods in the top bar.

Topics

Resources

Stars

Watchers

Forks

Languages

  • JavaScript 67.1%
  • Python 32.2%
  • CSS 0.7%