Compare commits

..

No commits in common. "d66332ed2a89a8767326f3007ad9ec866c969699" and "26facc6f479235ce2309def5e9f8efc6d30a77ae" have entirely different histories.

4 changed files with 8 additions and 83 deletions

View File

@ -1,65 +0,0 @@
#!/bin/bash
geticon() {
local icon=󰂎
state=$2
if [ "$state" = "Charging" ]; then
icon=󰂄
else
[ "$1" -gt 0 ] && icon=󰂃
[ "$1" -gt 10 ] && icon=󰁻
[ "$1" -gt 20 ] && icon=󰁼
[ "$1" -gt 30 ] && icon=󰁽
[ "$1" -gt 40 ] && icon=󰁾
[ "$1" -gt 50 ] && icon=󰁿
[ "$1" -gt 60 ] && icon=󰂀
[ "$1" -gt 70 ] && icon=󰂁
[ "$1" -gt 80 ] && icon=󰂂
[ "$1" -gt 90 ] && icon=󰁹
fi
echo "$icon"
}
getcolor() {
local color='#80ff80'
if [ "$2" = "Charging" ]; then
color='#0080ff'
else
[ "$1" -lt 60 ] && color='#ffff00'
[ "$1" -lt 30 ] && color='#ff8000'
[ "$1" -lt 15 ] && color='#ff0000'
fi
echo "$color"
}
batteries=$(acpi | rg 'Battery (\d)' -or '$1')
# echo "BATTERIES: $batteries"
for battery in $batteries; do
# echo "BATTERY $battery"
bt=$(acpi -b | grep "Battery $battery")
BAT=$(echo "$bt" | rg "(\d?\d?\d)%" -or '$1')
STAT=$(echo "$bt" | rg ": ([\w\s]+)," -or '$1')
ICON=$(geticon "$BAT" "$STAT")
COLOR=$(getcolor "$BAT" "$STAT")
text="$ICON $BAT"
printf "<span foreground=\"${COLOR}\">${text}</span>"
done
printf "\n\n"
# bt=$(acpi -b | grep "Battery $1")
# BAT=$(echo "$bt" | rg "(\d?\d?\d)%" -or '$1')
# STAT=$(echo "$bt" | rg ": ([\w\s]+)," -or '$1')
# ICON=$(geticon "$BAT" "$STAT")
# COLOR=$(getcolor "$BAT" "$STAT")
#echo "$ICON" $(($1 + 1)): "$BAT"%
# echo "$ICON" "$BAT"%
# echo "$ICON" "$BAT"%
echo "$COLOR"
exit 0

View File

@ -40,8 +40,7 @@ STAT=$(echo "$bt" | rg ": ([\w\s]+)," -or '$1')
ICON=$(geticon "$BAT" "$STAT")
COLOR=$(getcolor "$BAT" "$STAT")
#echo "$ICON" $(($1 + 1)): "$BAT"%
echo "$ICON" "$BAT"%
echo "$ICON" $(($1 + 1)): "$BAT"%
echo "$ICON" "$BAT"%
echo "$COLOR"

View File

@ -10,17 +10,13 @@
separator=true
separator_block_width=15
# [battery1]
# command=~/.dotfiles/bin/battery 0
# interval=30
[battery1]
command=~/.dotfiles/bin/battery 0
interval=30
# [battery2]
# command=~/.dotfiles/bin/battery 1
# interval=30
[batteries]
command=~/.dotfiles/bin/batteries
interval=10
markup=pango
[battery2]
command=~/.dotfiles/bin/battery 1
interval=30
#[volume]
#command=~/.config/i3blocks/volume-pipewire

7
prepare.sh Executable file → Normal file
View File

@ -1,10 +1,5 @@
#!/bin/bash
cat ~/.bashrc | grep nfrc || echo "source ~/.dotfiles/nfrc.sh" >> ~/.bashrc
sudo pacman -S fzf zoxide fd nvim stow
dirs=$(find ./ -maxdepth 1 -mindepth 1 -not -path "./.git" -not -path "./bin" -type d | sed 's:./::')
echo $dirs
dirs=$(find ./ -maxdepth 1 -mindepth 1 -not -path "./.git" -type d | sed 's:./::')