all repos — dotfiles @ feb1b0d1ce1c1a20554d9f687f32a4d59a986fc7

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