Last active
February 16, 2023 21:24
-
-
Save julianorchard/9f2d22a64f0fd8f40d1d98e2e347315d to your computer and use it in GitHub Desktop.
A useful single line battery status command for use with i3blocks
This file contains hidden or 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
| p=$(cat /sys/class/power_supply/BAT0/capacity); ! grep -q "Dischar" /sys/class/power_supply/BAT0/status && echo " ${p}%" && exit 0 || [ $p -gt 80 ] && echo " ${p}%" && exit 0 || [ $p -gt 60 ] && echo " ${p}%" && exit 0 || [ $p -gt 40 ] && echo " ${p}%" && exit 0 || [ $p -gt 20 ] && echo " ${p}%" && exit 0 || echo " ${p}%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment