1
0
mirror of https://github.com/artizirk/dotfiles.git synced 2024-11-22 16:30:59 +02:00

rearrange battery i3blocks script

This commit is contained in:
Arti Zirk 2022-02-27 13:15:20 +02:00
parent b06b6dc22d
commit ceb610585a

View File

@ -1,10 +1,15 @@
#!/bin/bash #!/bin/bash
#cd "/sys/class/power_supply/$BLOCK_INSTANCE/" #cd "/sys/class/power_supply/$BLOCK_INSTANCE/"
status=$(busctl get-property org.freedesktop.UPower /org/freedesktop/UPower/devices/DisplayDevice org.freedesktop.UPower.Device State | cut -d' ' -f2) print_dev_status() {
charge_f=$(busctl get-property org.freedesktop.UPower /org/freedesktop/UPower/devices/DisplayDevice org.freedesktop.UPower.Device Percentage | cut -d' ' -f2) dev_path=$1
status=$(busctl get-property org.freedesktop.UPower $dev_path org.freedesktop.UPower.Device State | cut -d' ' -f2)
charge_f=$(busctl get-property org.freedesktop.UPower $dev_path org.freedesktop.UPower.Device Percentage | cut -d' ' -f2)
echo -e "$charge_f %" echo -e "$charge_f %"
}
print_dev_status '/org/freedesktop/UPower/devices/DisplayDevice'
#if [[ "$charge_f" -lt 20 ]]; then #if [[ "$charge_f" -lt 20 ]]; then
# printf '\uf244' # printf '\uf244'