citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

ds4_battery (268B)


      1 #!/usr/bin/env bash
      2 
      3 for controller in /sys/class/power_supply/sony_controller_battery*; do
      4   capacity=$(<"$controller/capacity" tr '\n' '%')
      5   status=$(cat "$controller/status")
      6   echo -n "$capacity"
      7   [[ "$status" = "Charging" ]] && echo -n "+" || echo -n "-"
      8 done
      9