diff options
Diffstat (limited to 'etc/functions')
-rw-r--r-- | etc/functions/check_ac | 3 | ||||
-rw-r--r-- | etc/functions/check_nobat | 10 |
2 files changed, 3 insertions, 10 deletions
diff --git a/etc/functions/check_ac b/etc/functions/check_ac new file mode 100644 index 0000000..6ea4bb1 --- /dev/null +++ b/etc/functions/check_ac @@ -0,0 +1,3 @@ +## vim:ft=zsh +## check_ac - returns true if machine is running on AC +[[ $(cat /sys/class/power_supply/AC/online) == 1 ]] diff --git a/etc/functions/check_nobat b/etc/functions/check_nobat deleted file mode 100644 index 0f5dca3..0000000 --- a/etc/functions/check_nobat +++ /dev/null @@ -1,10 +0,0 @@ -## 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 |