all repos — dotfiles @ 01300e0bedebb297c6eb0186bdac214ae0135980

my *nix dotfiles

home/bin/bat (view raw)

 1#!/usr/bin/env bash
 2
 3cap="$(apm -l)"
 4is_charging="$(apm -a)"
 5
 6status="discharging"
 7
 8tmux_bat() {
 9    if [[ "$is_charging" -eq 1 ]]; then 
10        printf '%s%%' "+$cap"
11    else
12        printf '%s%%' "$cap"
13    fi
14}
15
16if [[ "$1" == "-q" ]]; then
17   tmux_bat 
18else
19    [[ "$is_charging" -eq 1 ]] &&
20        status="charging"
21    printf '%s%% [%s]\n' $cap $status 
22fi
23