all repos — dotfiles @ 9f6853476ca0455c9bd624cd79c2a89158e542bf

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