Site icon ChrisWrites.com

How To See Battery Time Remaining In macOS Sierra

The latest release of macOS Sierra (update 10.10.2, if you’re counting) saw an interesting change, as Apple removed a long-standing feature of the Mac user interface.

If you’re running the latest version of Sierra, then try clicking the battery icon in the menu bar: you’ll notice that the ‘Battery time remaining’ estimate is no more.

Although battery estimates are never 100% accurate (there’s a reason they’re called estimates, after all) MacBooks are designed to be mobile, so many users depend on their Mac’s internal battery on a day-to-day basis. Having a rough idea of how much longer your battery is going to hold out for is pretty useful, so understandably some Mac users aren’t too happy with Apple’s decision to remove this feature.

At the time of writing, macOS doesn’t give you a way of re-adding this estimate to your Mac menu bar, so if you want a rough idea of how much longer your current charge is going to last, then you’re going to have to get creative.

In this article, I’m going to show you how to use the GeekTool app to create a widget, or “geeklet,” that allows you to see this missing battery estimate information, from the comfort of your Sierra Desktop.

Getting Started with GeekTool

Start by downloading and installing the latest version of GeekTool. You can download GeekTool for free, but as with all free software you should consider making a donation to help support the work of the developer.

Launch GeekTool and the first screen you’ll see is the main GeekTool window.

Although we’ll be focusing on Shell geeklets for the majority of this article, there’s actually four different kinds of geeklet you can create:

Along the right side of the window you’ll also find some configuration options for GeekTool as a whole:

To create a geeklet, select one of the four geeklet icons (log, shell, image or web) and then drag this icon from the GeekTool window and drop it onto your Desktop. This creates a rectangular containment box on your Desktop, and opens a ‘Properties’ menu that contains all the options for configuring this particular geeklet.


The ‘Properties’ menu includes options for making cosmetic changes, such as altering the size of the geeklet’s text and its position inside the containment box. You can also make functional changes, most notably adding scripts to your Shell geeklets. This process will vary slightly depending on the kind of geeklet you want to create, but these are the fundamental steps underpinning every geeklet you create in GeekTool.

Creating a ‘Battery Time Remaining’ Geeklet

Now you have an overview of how GeekTool works, let’s get stuck into creating our battery geeklet:

  • Drag a ‘Shell’ geeklet onto your desktop.
  • In the ‘Properties’ menu, find the ‘Name’ field and give your geeklet a name.
  • Find the ‘Command’ field and click its accompanying three-dotted icon (where the cursor is positioned in the screenshot below).

  • This will open an external script editor, which you should use whenever you need to create a script that’s longer than one line. Copy/paste the following code into this editor, making sure not to alter any of the whitespace between each line:

     
    isFullyCharged=`ioreg -n AppleSmartBattery | grep FullyCharged | awk ‘{ print $5 }’`
     
    timeLeft=`ioreg -n AppleSmartBattery | grep TimeRemaining | awk ‘{ print $5 }’`
     
    if [ $isFullyCharged = “Yes” ] ; then
     
    echo “~”
     
    else
     
    ((hour=$timeLeft/60))
     
    ((min=$timeLeft-$hour*60))
     
    echo “$hour:$min”
     
    fi
     

    Click the red cross in the editor’s upper-left corner and, when prompted, confirm that you want to save your changes. The containment box on your Desktop will then update to display your device’s estimated battery life.

    This estimate will change over time, so make sure you specify how often this geeklet should update, by entering a value into the ‘Refresh every’ field. If you don’t specify a refresh rate, then your geeklet will never update.

    At this point, you’ll probably want to make some changes to the size and style of your geeklet’s text. Select the ‘Click here to set font & color….’ button, which will open the system’s standard ‘Fonts’ window.


    This window contains a wealth of options for customising your text, including changing its colour so it’s easier to read against your particular Desktop background, and altering the size of the text. By default, geeklet text is a bit on the small side so you’ll probably want to scale it up a few points.
    Once you’re happy with your text’s appearance, you should resize the containment box so it’s a little larger than your text. To resize a geeklet, grab the arrow icon in the bottom-right of the containment box and drag it.

    You may also want to tweak the geeklet’s position on your Desktop – simply grab the widget, drag it to the new position, and drop it.

    Enhancing your Battery Widget

    At this point, you’ve created a widget that displays your Mac’s estimated battery life, but there’s a couple of ways of getting more out of this widget that you may want to try.
    Firstly, at the moment this geeklet is just a series of numbers with no context. If you share your Mac with other people, then chances are they won’t be able to tell what these numbers mean. And, even if you’re the only person using this particular MacBook, then you may still not be a fan of seemingly random numbers floating around on your Desktop.
    If you want to provide your geeklet with some additional context, then you can either add a text label explaining what these numbers mean, or you can add an icon. Conveniently, you can add both of these to your Desktop, by creating an additional geeklet.

    Displaying Static Text

    To create a geeklet that exists solely to display the same piece of static text:

    Displaying A Static Image

    Alternatively, you may prefer to display an image alongside your battery geeklet.
    Start by deciding what image you want to display. You can either perform a quick Google search (something along the lines of “mac battery icon” should work) and download the image you want to use, or if you’re feeling creative you can boot up your favourite image editing software and create your own image.
    Once you have an image, you’re ready to create your geeklet:

    Displaying more battery stats

    At this point you have a fully-functioning geeklet that displays the time remaining until your battery hits zero percent – but this is just an estimate. If you want a more accurate insight into how long your battery is going to last, then you may want to create a second geeklet that displays some hard, cold facts about the state of your battery.

    One option is to create a second geeklet that displays the total amount of charge your Mac’s battery can hold, in Milliamp Hour (mAh) units, compared to how many mAh units are currently remaining.

    To create this supplemental widget, drop a new ‘Shell’ geeklet onto your Desktop and then copy/paste the following script into its ‘Command’ field:
    system_profiler SPPowerDataType | grep mAh
    Enter a refresh rate, and then style, resize and position the widget as desired.

    Some Alternatives

    If you only want to check the state of your battery every now and again, then it might not be worth going to all the effort of creating a special widget. If this is the case, then there’s several alternatives you may want to try, including two methods that make use of software already installed on your Mac.

    1. Activity Monitor

    You’ll find a battery estimate in your Mac’s Activity Monitor, which you can launch by navigating to Applications>Utilities>Activity Monitor. Make sure Activity Monitor’s ‘Energy’ tab is selected – you’ll find the ‘Time on battery’ estimate towards the bottom of this window.

    2. Terminal

    You can also get a battery estimate by issuing a Terminal command. Launch your Mac’s Terminal (Applications>Utilities) and then type the following command into the Terminal window:
    pmset -g batt
    Hit the ‘Enter’ key on your keyboard and the Terminal will return the percentage of battery remaining, plus an estimate of how long this charge will last.

    4. Battery Monitor

    Finally, if you want to access the battery estimate as part of your Mac’s menu bar, then you may want to try the third-party Battery Monitor app.

    Battery Monitor adds a battery icon to the menu bar; click this icon and it’ll open a dropdown menu containing a visual representation of the amount of battery consumed vs. your battery’s total capacity, alongside an estimate of how long this remaining charge will last.

    Exit mobile version