Dotfiles for different machines on different branches.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
500 B

  1. #!/usr/bin/env sh
  2. # Give a battery name (e.g. BAT0) as an argument.
  3. capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
  4. time=$(acpi | awk '{ print $5 }')
  5. status=$(cat /sys/class/power_supply/"$1"/status)
  6. [ -z $warn ] && warn=" "
  7. [ "$status" = "Charging" ] && color="#ffffff"
  8. printf "%s%s\n" "$(echo "$status" | sed -e "s/,//;s/Discharging/🔋/;s/Not Charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/' ) "