battery.sh 422 B

1234567891011
  1. #!/usr/bin/env bash
  2. # The script base is taken from http://openbox.org/wiki/Openbox:Pipemenus
  3. Battery=$(acpi -b | grep "Battery" | sed -nr '/Battery/s/.*(\<[[:digit:]]+%).*/\1/p')
  4. Thermal=$(acpi -t | grep "Thermal" | sed -nr "s/.*(\<[[:digit:]]+\.[[:digit:]]) degrees.*/\1°C/p" )
  5. echo "<openbox_pipe_menu>"
  6. echo "<separator label=\"Battery: $Battery\" />"
  7. echo "<item label=\"$Thermal\" />"
  8. echo "</openbox_pipe_menu>"