Skip to content
/ apodsmon Public

A Linux CLI utility for checking the AirPods battery level

License

Notifications You must be signed in to change notification settings

slp/apodsmon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apodsmon

A CLI utility to monitor the AirPods battery in Linux, using BlueZ. This is based on BlueZ's bluetooh-player.c and OpenPods.

This was written in a rush to scratch a personal itch, so don't expect anything fancy from this.

Build

apodsmon depends on dbus-1, glib-2.0 and gio-2.0. I didn't bother to implement autotools nor any other build system, so you may need to tune Makefile by hand.

Once you're ready, simply run make.

Using

Usage: apodsmon [output_file]

I'm using apodsmon to feed my i3status bar so, once executed, it keeps running monitoring for AirPods iBeacons, and printing the battery levels to either stdout, or output_file if specified in the command line.

I'm starting it from a systemd service like this:

[Unit]
Description=AirPods Battery Monitor

[Service]
ExecStart=~/bin/apodsmon /tmp/apodsmon.out

[Install]
WantedBy=default.target

Then I'm using this script as a wrapper for i3status:

#!/bin/sh
# shell script to prepend i3status with more stuff

i3status | while :
do
    read line
    apodmon=`tail -1 /tmp/apodsmon.out`
    if [ -z "$apodmon" ]; then
        echo "$line" || exit 1
    else
        echo "$apodmon | $line" || exit 1
    fi
done

About

A Linux CLI utility for checking the AirPods battery level

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published