Skip to content

Instantly share code, notes, and snippets.

@petr001
Last active February 13, 2023 19:19
Show Gist options
  • Save petr001/3f18cc7acd8f6cf9120be17d2c0996de to your computer and use it in GitHub Desktop.
Save petr001/3f18cc7acd8f6cf9120be17d2c0996de to your computer and use it in GitHub Desktop.
Plugin for BitBar to display battery percentage in macOS menu bar when charging your iPhone. Simply download the file and put it to BitBar plugin folder. Remember to install `libimobiledevice` dependency to have it working correctly.
#!/bin/sh
# <bitbar.title>iPhone battery info</bitbar.title>
# <bitbar.version>1.0</bitbar.version>
# IMPORTANT:
# - install libimobiledevice via brew before usage:
# $ brew install --HEAD libimobiledevice
# - tested with only one iphone connected
PATH=$PATH:/usr/local/bin
BATTERY=$(ideviceinfo -u $(idevice_id --list) --domain com.apple.mobile.battery | grep BatteryCurrentCapacity | sed 's/BatteryCurrentCapacity: //')
if [ "$BATTERY" ]; then
echo "📱⚡️" $BATTERY "% | size=12"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment