Created
May 4, 2024 17:41
-
-
Save MrJoy/5c81ef6d141d480ad704651c56bd25f8 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# From: https://apple.stackexchange.com/questions/415355/is-it-possible-to-detect-the-current-power-input-on-a-macbook | |
ioreg -rw0 -c AppleSmartBattery | | |
grep BatteryData | | |
grep -o '"AdapterPower"=[0-9]*' | | |
cut -c 16- | | |
xargs -I % lldb --batch -o "print/f %" | | |
grep -o '[0-9.]*' | | |
tail -1 |
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
#!/bin/bash | |
# See also: https://apple.stackexchange.com/questions/415355/is-it-possible-to-detect-the-current-power-input-on-a-macbook | |
ioreg -rw0 -c AppleSmartBattery | | |
grep AdapterDetails | | |
grep -v AppleRaw | | |
grep -o -e '"Watts"=[0-9]*' |
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
#!/bin/bash | |
# From: https://apple.stackexchange.com/questions/415355/is-it-possible-to-detect-the-current-power-input-on-a-macbook | |
ioreg -rw0 -c AppleSmartBattery | | |
grep -o -e '"ChargingCurrent"=[0-9]*' |
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
#!/bin/bash | |
# From: https://apple.stackexchange.com/questions/415355/is-it-possible-to-detect-the-current-power-input-on-a-macbook | |
ioreg -rw0 -c AppleSmartBattery | | |
grep BatteryData | | |
grep -o '"SystemPower"=[0-9]*' | | |
cut -c 15- | | |
xargs -I % lldb --batch -o "print/f %" | | |
grep -o '[0-9.]*' | | |
tail -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment