my dwmblocks setup

This commit is contained in:
2022-11-09 20:00:41 +01:00
parent a933ce0d61
commit 1528bb5fc9
6 changed files with 70 additions and 4 deletions

23
dwmblocks_scripts/dwm_battery Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
prct=$(upower -d | grep percentage | sed -n "1p" | sed -e 's/^.* //')
prctonly=$(upower -d | grep percentage | sed -n "1p" | sed -e 's/^.* //' | sed 's/%//')
stat=$(upower -d | grep -m1 state | sed -e 's/^.* //')
## if any argument
if [ $# -gt 0 ]; then
if [[ $stat == "charging" ]]; then
echo " ⚡ $prct"
exit
fi
if [[ $prctonly -gt 30 ]]; then
echo " 🔋 $prct"
exit
fi
echo " 🪫 $prct"
exit
fi
echo $prct