Created
February 22, 2020 20:50
-
-
Save paxperscientiam/ed6eb7d9fd463eb2bf78c2849d88bb8d to your computer and use it in GitHub Desktop.
macos low battery notifications (cron)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
declare -x GEM_HOME=/usr/local/ruby-lang/Gems | |
declare -x GEM_PATH=/usr/local/ruby-lang/Gems | |
if pmset -g batt | grep -Eo "Battery Power" | |
then | |
x=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) && [[ $x -lt 50 ]] && /usr/local/ruby-lang/Gems/bin/terminal-notifier -ignoreDnD -title "battery status" -message "low battery (${x}%)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment