Added programs

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
2021-03-22 21:27:54 +01:00
parent c1c92fc336
commit b82dc58f26
124 changed files with 18079 additions and 0 deletions

25
.local/bin/sb-battery Executable file
View File

@ -0,0 +1,25 @@
#!/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