Last active
August 29, 2015 13:57
-
-
Save notpratheek/9552758 to your computer and use it in GitHub Desktop.
The No-Nonsense battery indicator for tmux (that mostly works !)
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
# | |
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
# Version 2, March 2014 | |
# | |
# Copyright (C) 2014 Pratheek (contact me via github) | |
# | |
# Everyone is permitted to copy and distribute verbatim or modified | |
# copies of this license document, and changing it is allowed as long | |
# as the name is changed. | |
# | |
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
# | |
# 0. You just DO WHAT THE FUCK YOU WANT TO. | |
#!/usr/bin/env bash | |
BATPATH=/sys/class/power_supply/<YOUR DEVICE'S BATTERY> | |
STAT=$BATPATH/status | |
stat=$(cat $STAT) | |
FULL=$BATPATH/charge_full | |
NOW=$BATPATH/charge_now | |
full=$(cat $FULL) | |
curr=$(cat $NOW) | |
BAT_STAT=$( bc -l <<< "$curr / $full * 100" | cut -c -5 ) | |
echo $stat\:$BAT_STAT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment