summaryrefslogtreecommitdiff
path: root/etc/functions/check_nobat
blob: 0f5dca35d4fc14f391da3374d0c5120b8ea243e3 (plain)
1
2
3
4
5
6
7
8
9
10
## vim:ft=zsh
## check_nobat - returns true if machine is _not_ running on battery
typeset state
typeset -i ret=0

for state in /proc/acpi/battery/*/state(N); {
	fgrep -i 'discharging' $state &> /dev/null && ret=1
}

return $ret