all repos — dotfiles @ 8ce58989ee8649b21f47e086f6cf4dec73a3f4da

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