#!/bin/bash
# called by sfwbar bat.widget (left-click)

if [[ $(ls /sys/class/power_supply/ | grep 'BAT0') ]]; then
   BAT=bat0
elif [[ $(ls /sys/class/power_supply/ | grep 'BAT1') ]]; then
   BAT=bat1
fi
if [ -n "$BAT" ]; then
   /usr/local/Pup-SysInfo/func -sysinfo_$BAT
   cat /tmp/sysinfo-battery | grep -v '——' | Xdialog --fixed-font --title "Battery Status" --under-mouse --no-cancel --textbox "-" 20 110 2>/dev/null &
else
   batinfo &
fi
