.config
.emacs.d
.gkrellm2
.local
bin
Chatty
Checking-repo
Logc
Logs
Update
Update-kernel
backupSynology
backupSynologyMac
bin-cp
browser-x
chardetect
chatty-run
cleaner
cleanertmp
cmus-control
cmus-shell
cpumhz
debugger
dmenumount
dmenuumount
dmenuunicode
docker-start
dwmstatusbar
eix-repos-sync
epylint
euscan
ext
f2py
f2py3
f2py3.6
f2py3.7
f2py3.8
flask
futurize
gentoo-test
geoip
get-meraki-network-list
getforecast
gfetch
gfg
git-delete-branch
git-init-folder
haruhi-dl
iptables-restart
iptables-update
isort
jupyter-note
mailsync
minecraft-launcher
mouse-set
night
notify-program
password-manager
pasteurize
pwiz.py
pylint
pyreverse
rasp
rcon
record
remove-kernel
runJava
saver-off
sb-battery
sb-clock
sb-cpu
sb-mail
sb-mem
sb-music
sb-network
sb-temp
sb-volume
sb-weather
screen-switcher
screenshot
screenshot-area
set-wallpaper
shut-sup-rest
speedtest-cli
ssh-permissions
stream
suspend-at-time
symilar
tea
temp
term-wmi
terraform-ls
tester-ebuild
tester-ubuntu
tmux-display-fix
trans
twitch
video-convert
volume
welcomer
welcomer-serwer
wheel
wsl-notify
wylaczoff
yatqa
youtube-dl
yt-mp3
yt-video
Library
.alacritty.yml
.gitignore
.markdownlint.json
.signature
.skhdrc
.tmux.conf
.vimrc
.vimrc-def
.wall.jpg
.xinitrc
.yabairc
.zshrc
25 lines
804 B
Bash
Executable File
25 lines
804 B
Bash
Executable File
#!/bin/bash
|
|
print_battery() {
|
|
# Find the battery level
|
|
hash acpi || return 0
|
|
onl="$(acpi -V | grep "on-line")"
|
|
charge="$(cat /sys/class/power_supply/BAT*/capacity)"
|
|
time="$(awk '{print $5}' <(acpi))"
|
|
|
|
# Determine battery glyph by percentage range
|
|
if [[ -z $onl && ${charge} -gt 80 ]]; then
|
|
echo -e "🔋 ${charge}% ${time}"
|
|
elif [[ -z $onl && ${charge} -le 80 && ${charge} -gt 60 ]]; then
|
|
echo -e "🔋 ${charge}% ${time}"
|
|
elif [[ -z $onl && ${charge} -le 60 && ${charge} -gt 40 ]]; then
|
|
echo -e "🔋 ${charge}% ${time}"
|
|
elif [[ -z $onl && ${charge} -le 40 && ${charge} -gt 20 ]]; then
|
|
echo -e "🔋 ${charge}% ${time}"
|
|
elif [[ -z $onl && ${charge} -le 20 ]]; then
|
|
echo -e "❗🔋 ${charge}% ${time}"
|
|
# If charging, use animated glyph
|
|
else
|
|
echo -e "🔌"
|
|
fi
|
|
}
|
|
print_battery |