all repos — dotfiles @ 1b4587889cb88f62c147a396a0065b2bd7b1febb

my *nix dotfiles

bin/bat.sh (view raw)

 1#!/usr/bin/env bash
 2
 3fg="$(xres color15)"
 4light="$(xres color8)"
 5
 6cap=$(cat /sys/class/power_supply/BAT0/capacity)
 7status=$(cat /sys/class/power_supply/BAT0/status)
 8
 9if [[ "$1" == "-n" ]]; then
10    echo "$cap%"
11else
12    if [[ "$status" = "Charging" ]]
13    then
14    	echo -ne "%{F$light}+bat %{F$fg}$cap%"
15    else
16    	echo -ne "%{F$light}bat %{F$fg}$cap%"
17    fi
18fi