dwm Battery Monitor

dwm is a very simple window manager. It may not attract people who love eye candy in ttheir desktop but for people who prefer simplicity, I am sure it is attractive. In my daily activities, I just want to use as low as possible memory footprint for my desktop. dwm is the winner since it only need 1 MB of RAM ( compare for example with awesome which occupies 3 MB), and now there's only one more thing left: battery monitor.

dwm doesn't use a complicated libs or settings or configurations for the status, insted it can be displayed using xsetroot. So, I manage to make a status using this fish shell script:

while true
  xsetroot -name (acpi)
  set sisa (acpi | awk '{ print $4 }' | tr -d ',' | tr -d '%')
  if test $sisa -lt 20
    zenity --info --text="Plug the power!"
  end
  sleep 30
end

The only requirement is zenity. Put the script into whatever dir, and then [Alt]+[p] to run the command. Type fish <PATH_TO>/status.fish and then Enter. That's all. The status will display acpi result and then checks whether battery power less than 20% or not, if yes then dialog will be displayed.