Skip to content

Instantly share code, notes, and snippets.

@guimondmm
Last active May 31, 2022 22:02
Show Gist options
  • Save guimondmm/6735566f556ab757be215323c877aad5 to your computer and use it in GitHub Desktop.
Save guimondmm/6735566f556ab757be215323c877aad5 to your computer and use it in GitHub Desktop.
Bartender 4 "show for update" trigger script for iStat Menus 6 battery icon (macOS 11 Big Sur)
pmset -g batt | grep -c "Now drawing from 'Battery Power'"
@guimondmm
Copy link
Author

guimondmm commented Mar 12, 2021

How to get the iStat Menus 6 battery icon to display only when the battery is discharging using Bartender 4 (macOS 11 Big Sur):

This simple command returns 0 (false) if the MacBook is on AC power, and 1 (true) if the MacBook is on battery power.

  • Add a "show for update" trigger for the iStat Menus 6 battery icon in Bartender 4;
  • Select "Show when: script returns true" as the trigger condition;
  • Paste the command in the shell script field;
    pmset -g batt | grep -c "Now drawing from 'Battery Power'"
  • Set "run script every: 15 Seconds" and "show for: While comparison is true";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment