Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A shell script and launchd plist to launch/quit as appropriate
Branch: master

Initial upload

latest commit 438b9a7d3f
TJ Luoma authored
Failed to load latest commit information.


I use SlimBatteryMonitor instead of the default Mac OS X menu bar item for the battery status.

SBM has many more options than the built-in menu bar item, including the ability to change what it is showing you in the menu bar.

It can be configured to "minimize" itself when the battery is fully charged, but it still retains some width in the menu bar -- and that is prime real estate.

I realized that it would be better to only run SBM when I was running on battery, but knew better than to trust my own memory, so I told the computer to do it for me.

This shell script will check the current Mac OS X battery status by running this command:

FULLY_CHARGED=$(ioreg -c AppleSmartBattery | awk -F' ' '/FullyCharged/{print $NF}')

The $FULLY_CHARGED variable will either be set to 'Yes' or 'No' (well, assuming that the Mac in question has a battery).

The script then uses that variable to either:

  1. launch (IFF it is not already running) when the battery is not fully charged.

  2. quit (IFF it is running) when the battery is fully charged.

See the comments in the shell script for more info.


  1. You must install the plist file to ~/Library/LaunchAgents (you may have to create that folder if it doesn't exist)

  2. You should install at /usr/local/bin/ because that is where the plist file will look for it. If you install it somewhere else, you must edit the plist to reflect the new path.

  3. After moving the plist into place, you must either reboot or enter this in

    launchctl load ~/Library/LaunchAgents/com.tjluoma.slimbatterymonitor.plist

  4. After moving into place, you must make sure it is executable:

    chmod 755 /usr/local/bin/

If you installed it somewhere else, change the path as appropriate.


If something doesn't seem to work, make sure that your battery reports its charge status. If you enter this in Terminal:

ioreg -c AppleSmartBattery | fgrep FullyCharged             

you ought to see something like this:

| |           "FullyCharged" = No


| |           "FullyCharged" = Yes

If you do not, this script will probably not work properly for you. (I tested it on 10.7.3)

If does not launch as expected, be sure that

open -a SlimBatteryMonitor

works when entered on the command line.


I had already written this before I read "Have battery status only show in menu bar when running on battery power" at but that was what "inspired" me to share it via GitHub.


I am not affiliated with the official in any way.

Use at your own risk, etc.

Something went wrong with that request. Please try again.