Skip to content

Commit

Permalink
Add batman, the battery status manager
Browse files Browse the repository at this point in the history
  • Loading branch information
rkk committed Jan 13, 2018
1 parent 4b93f23 commit ab5b2a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion I3blocks/config
Expand Up @@ -21,7 +21,8 @@ separator=false
[separator]

[power]
command=acpi -b | grep "^Battery" | cut -d, -f3 | cut -d: --fields=1,2
#command=acpi -b | grep "^Battery" | cut -d, -f3 | cut -d: --fields=1,2
command=batman
interval=10
separator=false

Expand Down
22 changes: 22 additions & 0 deletions Scripts/batman
@@ -0,0 +1,22 @@
#!/bin/bash
#
# Displays battery statistics for usage in menus, e.g
# i3blocks or i3status.

if [ $(uname -s) = "Linux" ]; then
cmd='acpi -b | grep "^Battery" | cut -d, -f3 | cut -d: --fields=1,2'
fi


if [ $(uname -s) = "OpenBSD" ]; then
is_charging=$(apm -a)
if [ ${is_charging} = "1" ]; then
echo "Charging"
exit 0
fi
cmd="apm -m"
fi

output=$(${cmd})
echo ${output}

0 comments on commit ab5b2a7

Please sign in to comment.