dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

[.macos] Hide battery percentage (com.apple.menuextra.battery user defaults)

Open ktgvv opened this issue 7 years ago • 5 comments

In reply to this commit, it is still possible to hide battery percentage [at least on OS X 10.9.5 Mavericks]. However, display remaining battery time has been removed by Apple.

defaults write com.apple.menuextra.battery ShowPercent -bool false # Hide battery percentage.

ktgvv avatar Aug 20 '16 19:08 ktgvv

The correct values to be set on High Sierra are YES and NO:

defaults write com.apple.menuextra.battery ShowPercent -string "YES" defaults write com.apple.menuextra.battery ShowPercent -string "NO"

I'm not sure since which macOS version, though.

mattarau avatar Nov 08 '17 10:11 mattarau

what @kvpb posted does not work with OS X 10.11.6 El Capitan, at least.

esaruoho avatar Nov 25 '17 21:11 esaruoho

Works with macOS 10.15.7, remember to killall SystemUIServer for it to take effect.

jidicula avatar Nov 21 '20 17:11 jidicula

In macOS Monterey, we should use the following commands to show the battery percentage:

defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter.plist BatteryShowPercentage -bool true
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter.plist BatteryShowPercentage -bool false

It is not necessary to reset any module/application to see the changes.

arturoherrero avatar Aug 03 '22 23:08 arturoherrero

You can just use -curentHost

defaults -currentHost write com.apple.controlcenter.plist BatteryShowPercentage -bool true

tshu-w avatar Aug 05 '22 01:08 tshu-w